From 0a83ef3cf765385691a099dbb85e283b43dc5465 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Thu, 17 Sep 2015 10:28:38 -0700 Subject: [PATCH] registration: Fix merging of array_plus 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 | 2 +- tests/phpunit/includes/registration/ExtensionRegistryTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/registration/ExtensionRegistry.php b/includes/registration/ExtensionRegistry.php index f838103928..787a4b0a53 100644 --- a/includes/registration/ExtensionRegistry.php +++ b/includes/registration/ExtensionRegistry.php @@ -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] ); diff --git a/tests/phpunit/includes/registration/ExtensionRegistryTest.php b/tests/phpunit/includes/registration/ExtensionRegistryTest.php index b8b1b06922..201cbfcdf1 100644 --- a/tests/phpunit/includes/registration/ExtensionRegistryTest.php +++ b/tests/phpunit/includes/registration/ExtensionRegistryTest.php @@ -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, ), -- 2.20.1