mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX Clone Config_LRU incl. objects in array
Caused key confusions when using Config::nest()/unnest()
This commit is contained in:
parent
04c3b5ee94
commit
a415db91d4
@ -623,6 +623,20 @@ class Config_LRU {
|
|||||||
$this->indexing = array();
|
$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()) {
|
public function set($key, $val, $tags = array()) {
|
||||||
// Find an index to set at
|
// Find an index to set at
|
||||||
$replacing = null;
|
$replacing = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user