mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
Follow-up I9202066d: array_unique leaves gaps in keys, we need to run array_values on it afterwards
While that commit fixed the issue it was intended to address, it also completely broke VE everywhere else. Basically you'd end up with a result like this: array(5) { [0]=> int(14) [1]=> int(6) [2]=> int(2) [5]=> int(0) [6]=> int(250) } With the lack of 3 and 4 keys making the JSON formatter think we've got an object. Bug: T139094 Change-Id: Ia21fd4bd352afc9170357576a3e0eb17b4528326
This commit is contained in:
parent
40d606abdc
commit
e639525a9c
|
@ -673,12 +673,12 @@ class ApiVisualEditor extends ApiBase {
|
|||
// Note: existing numeric keys might exist, and so array_merge cannot be used
|
||||
(array) $config->get( 'VisualEditorAvailableNamespaces' ) +
|
||||
(array) ExtensionRegistry::getInstance()->getAttribute( 'VisualEditorAvailableNamespaces' );
|
||||
return array_unique( array_map( function ( $namespace ) {
|
||||
return array_values( array_unique( array_map( function ( $namespace ) {
|
||||
// Convert canonical namespace names to IDs
|
||||
return is_numeric( $namespace ) ?
|
||||
$namespace :
|
||||
MWNamespace::getCanonicalIndex( strtolower( $namespace ) );
|
||||
}, array_keys( array_filter( $availableNamespaces ) ) ) );
|
||||
}, array_keys( array_filter( $availableNamespaces ) ) ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue