From: Brad Jorsch Date: Tue, 2 Oct 2018 21:18:38 +0000 (-0400) Subject: Language: Don't return aliases to namespaces that don't exist X-Git-Tag: 1.34.0-rc.0~3921 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=0adc109608d7294881c3d3b4a71d4a26df7c1bd1;p=lhc%2Fweb%2Fwiklou.git Language: Don't return aliases to namespaces that don't exist On a multi-wiki server using a l10n cache, the cache will probably include aliases from all extensions enabled for any wiki while the namespaces themselves will only be defined on the wikis where the extension is loaded. Bug: T206030 Change-Id: I985dfa3eb17944d5fc0c5be0979be21504fb1341 --- diff --git a/languages/Language.php b/languages/Language.php index 5897241039..8104b2c845 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -703,6 +703,14 @@ class Language { } $this->namespaceAliases = $aliases + $convertedNames; + + # Filter out aliases to namespaces that don't exist, e.g. from extensions + # that aren't loaded here but are included in the l10n cache. + # (array_intersect preserves keys from its first argument) + $this->namespaceAliases = array_intersect( + $this->namespaceAliases, + array_keys( $this->getNamespaces() ) + ); } return $this->namespaceAliases;