Topic on Extension talk:NamespacePaths

Undesired changes to keys defined in $wgNamespacePaths when extension is active

2
UniversalEntropy (talkcontribs)

To summarize:

After having a wiki updated from 1.35 to 1.39, in which the configuration was working just fine, the keys pointing to custom namespaces somehow get themselves chanted into zero-indexed integers, as though the values are stored in a regular array.

With $wgNamespacePaths as configured, assuming that NS_FOO = 3000 and NS_BAR = 3002:

LocalSettings.php

$wgArticlePath = "/$1";
$wgNamespacePaths = [
    NS_FOO => "/foo/$1",
    NS_BAR => "/bar/$1"
];

The associative array as evaluated is expected to return

Array
(
    [3000] => /foo/$1
    [3002] => /bar/$1
)

However, with the extension active, the actual outcome gives me

Array
(
    [0] => /foo/$1
    [1] => /bar/$1
)

thereby causing these short links to point to the wrong namespaces in that manner.

With all these taken into account, did I misconfigure anything, or am I missing something, or does the extension have an existing issue that has yet to be fixed?

If it's any of the former two, how do I go along with solving the problem in question?

UPDATE: I found out the underlying cause, that being the absence of "merge_strategy": "array_plus" to be specified in the NamespacePaths config of extension.json.

95.98.134.109 (talkcontribs)

I also had this issue in MediaWiki 1.41.

Apparently fixed by adding to extensions/NamespacePaths/extension.json

in the section "config"/"NamespacePaths", the key-value pair "merge_strategy": "array_plus"

Thanks, UniversalEntropy, for the help!

Reply to "Undesired changes to keys defined in $wgNamespacePaths when extension is active"