`absint()` should always return `PHP_INT_MAX` if the resulting value exceeds it.

See [28855].
Fixes #23383.

Built from https://develop.svn.wordpress.org/trunk@28856


git-svn-id: http://core.svn.wordpress.org/trunk@28659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-06-26 18:24:15 +00:00
parent bae2b054ad
commit cd93bc05e5
1 changed files with 2 additions and 7 deletions

View File

@ -3000,15 +3000,10 @@ 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, $limit = false ) {
$int = abs( intval( $maybeint ) );
if ( $limit && $int > PHP_INT_MAX ) {
$int = PHP_INT_MAX;
}
return $int;
function absint( $maybeint ) {
return min( abs( (int) $maybeint ), PHP_INT_MAX );
}
/**