FIX SplFixedArray causes segfaults in old versions of PHP

This commit is contained in:
Hamish Friedlander 2013-03-18 10:22:11 +13:00
parent e0e481fc46
commit 3543a93623

View File

@ -598,7 +598,13 @@ class Config_LRU {
protected $c = 0;
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
for ($i = 0; $i < self::SIZE; $i++) {