Make WordPress Core

Ticket #31600: 31600-incr_decr_offset_type_check-2.diff

File 31600-incr_decr_offset_type_check-2.diff, 697 bytes (added by jipmoors, 9 years ago)

Simplified the code.

  • src/wp-includes/cache.php

     
    467467                if ( ! is_numeric( $this->cache[ $group ][ $key ] ) )
    468468                        $this->cache[ $group ][ $key ] = 0;
    469469
    470                 $offset = (int) $offset;
     470                $offset = is_numeric( $offset ) ? (int) $offset : 0;
    471471
    472472                $this->cache[ $group ][ $key ] -= $offset;
    473473
     
    583583                if ( ! is_numeric( $this->cache[ $group ][ $key ] ) )
    584584                        $this->cache[ $group ][ $key ] = 0;
    585585
    586                 $offset = (int) $offset;
     586                $offset = is_numeric( $offset ) ? (int) $offset : 0 ;
    587587
    588588                $this->cache[ $group ][ $key ] += $offset;