From: Fomafix Date: Tue, 16 Oct 2018 09:46:24 +0000 (+0200) Subject: Linker: Use RequestContext::getMain()->getLanguage() instead of $wgLang X-Git-Tag: 1.34.0-rc.0~2561^2 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=cf568ba823e322628dc1d10b785be244c0a21a20;p=lhc%2Fweb%2Fwiklou.git Linker: Use RequestContext::getMain()->getLanguage() instead of $wgLang $wgLang can be an StubUserLang object. This change allows to force a Language object. Change-Id: I93c79b985a2ee49648c678844eef189126a4d765 --- diff --git a/includes/Linker.php b/includes/Linker.php index b605acd894..947ad6d094 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1580,9 +1580,8 @@ class Linker { * @return string Full html of the TOC */ public static function tocList( $toc, $lang = null ) { - global $wgLang; - $lang = $lang ?? $wgLang; - if ( !is_object( $lang ) ) { + $lang = $lang ?? RequestContext::getMain()->getLanguage(); + if ( !$lang instanceof Language ) { wfDeprecated( __METHOD__ . ' with type other than Language for $lang', '1.33' ); $lang = wfGetLangObj( $lang ); }