registration: Fix merging of array_plus
authorKunal Mehta <legoktm@gmail.com>
Thu, 17 Sep 2015 17:28:38 +0000 (10:28 -0700)
committerKunal Mehta <legoktm@gmail.com>
Thu, 17 Sep 2015 17:29:02 +0000 (10:29 -0700)
We want the local configuration ($GLOBALS[$key]) to override the default
values ($val). This matches what `array_merge` does.

Bug: T112868
Change-Id: I9c333a1fa67d3f24e09ffed3072b2897389f6139

includes/registration/ExtensionRegistry.php
tests/phpunit/includes/registration/ExtensionRegistryTest.php

index f838103..787a4b0 100644 (file)
@@ -225,7 +225,7 @@ class ExtensionRegistry {
                                        $GLOBALS[$key] = wfArrayPlus2d( $GLOBALS[$key], $val );
                                        break;
                                case 'array_plus':
-                                       $GLOBALS[$key] = $val + $GLOBALS[$key];
+                                       $GLOBALS[$key] += $val;
                                        break;
                                case 'array_merge':
                                        $GLOBALS[$key] = array_merge( $val, $GLOBALS[$key] );
index b8b1b06..201cbfc 100644 (file)
@@ -123,7 +123,7 @@ class ExtensionRegistryTest extends MediaWikiTestCase {
                                )
                        ),
                        array(
-                               'Global already set, 2d array with integer keys',
+                               'Global already set, array with integer keys',
                                array(
                                        'mwNamespacesFoo' => array(
                                                100 => true,
@@ -139,7 +139,7 @@ class ExtensionRegistryTest extends MediaWikiTestCase {
                                ),
                                array(
                                        'mwNamespacesFoo' => array(
-                                               100 => false,
+                                               100 => true,
                                                102 => false,
                                                500 => true,
                                        ),