Merge pull request #1297 from silverstripe-rebelalliance/feature/config

FIX SplFixedArray causes segfaults in old versions of PHP
This commit is contained in:
Sean Harvey 2013-03-17 14:27:27 -07:00
commit df7671acb4

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++) {