From e6e4ffd2f4b4f8d93c0524605da1f29ffa9daeee Mon Sep 17 00:00:00 2001 From: Marius Hoch Date: Sat, 3 Oct 2015 19:15:33 +0200 Subject: [PATCH] Fix ObjectCache::newAccelerator with string fallback in PHP 5.3 Because in PHP5.3: php > $a = "hash"; php > echo isset( $a['fallback'] ); 1 php > echo $a['fallback']; h This will fix using MediaWiki with MySQL on PHP5.3 if neither APC, xcache nor wincache are available. Change-Id: Iebf034be75b282e2654cd298713455caf062eda4 --- includes/objectcache/ObjectCache.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/objectcache/ObjectCache.php b/includes/objectcache/ObjectCache.php index 0d40052074..70e97ff148 100644 --- a/includes/objectcache/ObjectCache.php +++ b/includes/objectcache/ObjectCache.php @@ -198,7 +198,9 @@ class ObjectCache { */ public static function newAccelerator( $params = array(), $fallback = null ) { if ( $fallback === null ) { - if ( isset( $params['fallback'] ) ) { + // The is_array check here is needed because in PHP 5.3: + // $a = 'hash'; isset( $params['fallback'] ); yields true + if ( is_array( $params ) && isset( $params['fallback'] ) ) { $fallback = $params['fallback']; } elseif ( !is_array( $params ) ) { $fallback = $params; -- 2.20.1