mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
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:
parent
bf0953b07b
commit
3c5695e87d
|
@ -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 ) ?
|
||||
|
|
Loading…
Reference in a new issue