From 3543a93623d7bfe63f6e28c120bbd25b45235d05 Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Mon, 18 Mar 2013 10:22:11 +1300 Subject: [PATCH] FIX SplFixedArray causes segfaults in old versions of PHP --- core/Config.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/Config.php b/core/Config.php index fbc6ddfe6..65012f2a9 100644 --- a/core/Config.php +++ b/core/Config.php @@ -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++) {