mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
FIX SplFixedArray causes segfaults in old versions of PHP
This commit is contained in:
parent
e0e481fc46
commit
3543a93623
@ -598,7 +598,13 @@ class Config_LRU {
|
|||||||
protected $c = 0;
|
protected $c = 0;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->cache = new SplFixedArray(self::SIZE);
|
if (version_compare(PHP_VERSION, '5.3.7', '<')) {
|
||||||
|
// SplFixedArray causes seg faults before PHP 5.3.7
|
||||||
|
$this->cache = array();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->cache = new SplFixedArray(self::SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
// Pre-fill with stdClass instances. By reusing we avoid object-thrashing
|
// Pre-fill with stdClass instances. By reusing we avoid object-thrashing
|
||||||
for ($i = 0; $i < self::SIZE; $i++) {
|
for ($i = 0; $i < self::SIZE; $i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user