Merge pull request #1335 from chillu/pulls/config-clone-nest

FIX Clone Config_LRU incl. objects in array
This commit is contained in:
Sam Minnée 2013-03-26 13:46:30 -07:00
commit 8dbdb00400

View File

@ -623,6 +623,20 @@ class Config_LRU {
$this->indexing = array();
}
public function __clone() {
if (version_compare(PHP_VERSION, '5.3.7', '<')) {
// SplFixedArray causes seg faults before PHP 5.3.7
$cloned = array();
}
else {
$cloned = new SplFixedArray(self::SIZE);
}
for ($i = 0; $i < self::SIZE; $i++) {
$cloned[$i] = clone $this->cache[$i];
}
$this->cache = $cloned;
}
public function set($key, $val, $tags = array()) {
// Find an index to set at
$replacing = null;