Make WordPress Core

Changeset 28856


Ignore:
Timestamp:
06/26/2014 06:23:51 PM (9 years ago)
Author:
wonderboymusic
Message:

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

See [28855].
Fixes #23383.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r28855 r28856  
    30013001 *
    30023002 * @param mixed $maybeint Data you wish to have converted to a nonnegative integer
    3003  * @param bool $limit Whether to only return up to PHP_INT_MAX.
    30043003 * @return int An nonnegative integer
    30053004 */
    3006 function absint( $maybeint, $limit = false ) {
    3007     $int = abs( intval( $maybeint ) );
    3008     if ( $limit && $int > PHP_INT_MAX ) {
    3009         $int = PHP_INT_MAX;
    3010     }
    3011     return $int;
     3005function absint( $maybeint ) {
     3006    return min( abs( (int) $maybeint ), PHP_INT_MAX );
    30123007}
    30133008
Note: See TracChangeset for help on using the changeset viewer.