From: Bartosz DziewoƄski Date: Sun, 29 Mar 2015 16:29:41 +0000 (+0200) Subject: ResourceLoaderImageModule: Improve PHP 5.3 compatibility X-Git-Tag: 1.31.0-rc.0~11949 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=5042d260ce5190cce0c325b7cb5b618b3cff73bc;p=lhc%2Fweb%2Fwiklou.git ResourceLoaderImageModule: Improve PHP 5.3 compatibility In PHP 5.3.x and older, the isset() check in code example below will yield true. In PHP 5.4 and later, and HHVM, it will correctly yield false. http://3v4l.org/8p3hm $options = 'foo'; isset( $options['bar'] ); Let's not depend on this behavior here. Change-Id: I67e83af8afe85b3ddfb5db0009759b8ac5bb7d67 --- diff --git a/includes/resourceloader/ResourceLoaderImageModule.php b/includes/resourceloader/ResourceLoaderImageModule.php index 5be4419c11..3d65745fed 100644 --- a/includes/resourceloader/ResourceLoaderImageModule.php +++ b/includes/resourceloader/ResourceLoaderImageModule.php @@ -158,7 +158,7 @@ class ResourceLoaderImageModule extends ResourceLoaderModule { $imageDesc = is_string( $options ) ? $options : $options['image']; $allowedVariants = array_merge( - isset( $options['variants'] ) ? $options['variants'] : array(), + is_array( $options ) && isset( $options['variants'] ) ? $options['variants'] : array(), $this->getGlobalVariants( $type ) ); if ( isset( $this->variants[$type] ) ) {