WordPress.org

Make WordPress Core

Changeset 9740


Ignore:
Timestamp:
11/17/2008 09:01:12 PM (12 years ago)
Author:
ryan
Message:

Use clone to break object refs when setting and getting cache. see #8146 #8191

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/cache.php

    r8742 r9740  
    314314        if (isset ($this->cache[$group][$id])) {
    315315            $this->cache_hits += 1;
    316             return $this->cache[$group][$id];
     316            if ( is_object($this->cache[$group][$id]) )
     317                return wp_clone($this->cache[$group][$id]);
     318            else
     319                return $this->cache[$group][$id];
    317320        }
    318321
     
    373376        if (NULL === $data)
    374377            $data = '';
     378
     379        if ( is_object($data) )
     380            $data = wp_clone($data);
    375381
    376382        $this->cache[$group][$id] = $data;
  • trunk/wp-includes/functions.php

    r9662 r9740  
    28732873}
    28742874
     2875function wp_clone($object) {
     2876  return version_compare(phpversion(), '5.0') < 0 ? $object : clone($object);
     2877}
     2878
     2879
    28752880?>
Note: See TracChangeset for help on using the changeset viewer.