From: Marius Hoch Date: Sat, 3 Oct 2015 17:15:33 +0000 (+0200) Subject: Fix ObjectCache::newAccelerator with string fallback in PHP 5.3 X-Git-Tag: 1.31.0-rc.0~9569^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/rappels.php?a=commitdiff_plain;h=e6e4ffd2f4b4f8d93c0524605da1f29ffa9daeee;p=lhc%2Fweb%2Fwiklou.git 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 --- 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;