From 5042d260ce5190cce0c325b7cb5b618b3cff73bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Sun, 29 Mar 2015 18:29:41 +0200 Subject: [PATCH] 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 --- includes/resourceloader/ResourceLoaderImageModule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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] ) ) { -- 2.20.1