Make WordPress Core

Ticket #25308: 25308.patch

File 25308.patch, 2.9 KB (added by SergeyBiryukov, 11 years ago)
  • src/wp-includes/cache.php

     
    2121 * @param int $expire When the cache data should be expired
    2222 * @return bool False if cache key and group already exist, true on success
    2323 */
    24 function wp_cache_add($key, $data, $group = '', $expire = 0) {
     24function wp_cache_add( $key, $data, $group = '', $expire = 0 ) {
    2525        global $wp_object_cache;
    2626
    27         return $wp_object_cache->add($key, $data, $group, $expire);
     27        return $wp_object_cache->add( $key, $data, $group, (int) $expire );
    2828}
    2929
    3030/**
     
    154154 * @param int $expire When to expire the cache contents
    155155 * @return bool False if not exists, true if contents were replaced
    156156 */
    157 function wp_cache_replace($key, $data, $group = '', $expire = 0) {
     157function wp_cache_replace( $key, $data, $group = '', $expire = 0 ) {
    158158        global $wp_object_cache;
    159159
    160         return $wp_object_cache->replace($key, $data, $group, $expire);
     160        return $wp_object_cache->replace( $key, $data, $group, (int) $expire );
    161161}
    162162
    163163/**
     
    173173 * @param int $expire When to expire the cache contents
    174174 * @return bool False on failure, true on success
    175175 */
    176 function wp_cache_set($key, $data, $group = '', $expire = 0) {
     176function wp_cache_set( $key, $data, $group = '', $expire = 0 ) {
    177177        global $wp_object_cache;
    178178
    179         return $wp_object_cache->set($key, $data, $group, $expire);
     179        return $wp_object_cache->set( $key, $data, $group, (int) $expire );
    180180}
    181181
    182182/**
     
    320320         * @param int $expire When to expire the cache contents
    321321         * @return bool False if cache key and group already exist, true on success
    322322         */
    323         function add( $key, $data, $group = 'default', $expire = '' ) {
     323        function add( $key, $data, $group = 'default', $expire = 0 ) {
    324324                if ( wp_suspend_cache_addition() )
    325325                        return false;
    326326
     
    334334                if ( $this->_exists( $id, $group ) )
    335335                        return false;
    336336
    337                 return $this->set($key, $data, $group, $expire);
     337                return $this->set( $key, $data, $group, (int) $expire );
    338338        }
    339339
    340340        /**
     
    509509         * @param int $expire When to expire the cache contents
    510510         * @return bool False if not exists, true if contents were replaced
    511511         */
    512         function replace( $key, $data, $group = 'default', $expire = '' ) {
     512        function replace( $key, $data, $group = 'default', $expire = 0 ) {
    513513                if ( empty( $group ) )
    514514                        $group = 'default';
    515515
     
    520520                if ( ! $this->_exists( $id, $group ) )
    521521                        return false;
    522522
    523                 return $this->set( $key, $data, $group, $expire );
     523                return $this->set( $key, $data, $group, (int) $expire );
    524524        }
    525525
    526526        /**
     
    559559         * @param int $expire Not Used
    560560         * @return bool Always returns true
    561561         */
    562         function set($key, $data, $group = 'default', $expire = '') {
     562        function set( $key, $data, $group = 'default', $expire = 0 ) {
    563563                if ( empty( $group ) )
    564564                        $group = 'default';
    565565