Add a second optional parameter to `absint()` to limit the result to `PHP_INT_MAX`.
See #23383. Built from https://develop.svn.wordpress.org/trunk@28855 git-svn-id: http://core.svn.wordpress.org/trunk@28658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
81b8b6cfbc
commit
bae2b054ad
|
@ -3000,10 +3000,15 @@ function dead_db() {
|
|||
* @since 2.5.0
|
||||
*
|
||||
* @param mixed $maybeint Data you wish to have converted to a nonnegative integer
|
||||
* @param bool $limit Whether to only return up to PHP_INT_MAX.
|
||||
* @return int An nonnegative integer
|
||||
*/
|
||||
function absint( $maybeint ) {
|
||||
return abs( intval( $maybeint ) );
|
||||
function absint( $maybeint, $limit = false ) {
|
||||
$int = abs( intval( $maybeint ) );
|
||||
if ( $limit && $int > PHP_INT_MAX ) {
|
||||
$int = PHP_INT_MAX;
|
||||
}
|
||||
return $int;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue