Remove comments about isset( $string['foo'] ) being true on PHP 5.3
authorBartosz Dziewoński <matma.rex@gmail.com>
Wed, 17 Feb 2016 19:27:39 +0000 (20:27 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Wed, 17 Feb 2016 20:12:30 +0000 (20:12 +0000)
...but don't remove the code. Calling isset( $bar['foo'] ) without checking
that $bar is an array seems not very nice to me.

Change-Id: I822c925b6f36bf34902f8075e54f71fe4f6d2566

includes/objectcache/ObjectCache.php
includes/registration/ExtensionRegistry.php

index 12a673a..6d26419 100644 (file)
@@ -269,8 +269,6 @@ class ObjectCache {
         */
        public static function newAccelerator( $params = [], $fallback = null ) {
                if ( $fallback === null ) {
-                       // 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 ) ) {
index bc9b26d..33395f7 100644 (file)
@@ -234,9 +234,7 @@ class ExtensionRegistry {
                foreach ( $info['globals'] as $key => $val ) {
                        // If a merge strategy is set, read it and remove it from the value
                        // so it doesn't accidentally end up getting set.
-                       // Need to check $val is an array for PHP 5.3 which will return
-                       // true on isset( 'string'['foo'] ).
-                       if ( isset( $val[self::MERGE_STRATEGY] ) && is_array( $val ) ) {
+                       if ( is_array( $val ) && isset( $val[self::MERGE_STRATEGY] ) ) {
                                $mergeStrategy = $val[self::MERGE_STRATEGY];
                                unset( $val[self::MERGE_STRATEGY] );
                        } else {