From 0adc109608d7294881c3d3b4a71d4a26df7c1bd1 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Tue, 2 Oct 2018 17:18:38 -0400 Subject: [PATCH] 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 --- languages/Language.php | 8 ++++++++ 1 file changed, 8 insertions(+) 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; -- 2.20.1