Alex Monk has uploaded a new change for review.
https://gerrit.wikimedia.org/r/296659
Change subject: Don't use array_merge for namespace configs
......................................................................
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
---
M ApiVisualEditor.php
1 file changed, 4 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/59/296659/1
diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php
index b9b066a..357592f 100644
--- a/ApiVisualEditor.php
+++ b/ApiVisualEditor.php
@@ -665,7 +665,10 @@
* @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 ) ?
--
To view, visit https://gerrit.wikimedia.org/r/296659
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e3ecb3e9e65443ba0d44f8eeb67d6b390eca0bd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: wmf/1.28.0-wmf.8
Gerrit-Owner: Alex Monk <[email protected]>
Gerrit-Reviewer: DLynch <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits