Don't use array_merge for namespace configs

array_merge renumbers numeric keys. The namespace configs can be either
numeric or names. If they're numeric, they shouldn't be renumbered. So just
add them.

Bug: T138980
Change-Id: I3e3ecb3e9e65443ba0d44f8eeb67d6b390eca0bd
This commit is contained in:
David Lynch 2016-06-29 16:10:45 -05:00
parent bf0953b07b
commit 3c5695e87d

View file

@ -669,7 +669,10 @@ class ApiVisualEditor extends ApiBase {
* @return array
*/
public static function getAvailableNamespaceIds( Config $config ) {
$availableNamespaces = $config->get( 'VisualEditorAvailableNamespaces' );
$availableNamespaces =
// Note: existing numeric keys might exist, and so array_merge cannot be used
(array) $config->get( 'VisualEditorAvailableNamespaces' ) +
(array) ExtensionRegistry::getInstance()->getAttribute( 'VisualEditorAvailableNamespaces' );
return array_map( function ( $namespace ) {
// Convert canonical namespace names to IDs
return is_numeric( $namespace ) ?