From: Brad Jorsch Date: Fri, 29 Jan 2016 19:30:25 +0000 (-0500) Subject: MessageCache: Don't get a ParserOptions for $wgUser before the end of Setup.php X-Git-Tag: 1.31.0-rc.0~8152^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=058aec4c76129b7ee8541692a8a48f8046e15bb6;p=lhc%2Fweb%2Fwiklou.git MessageCache: Don't get a ParserOptions for $wgUser before the end of Setup.php Until Setup.php completes, we can't access the "current" user and trying to do so logs a warning. So don't try. Bug: T124367 Change-Id: If31230407829c04f34d9cfefcbb97edacb949b6d --- diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 24df5748b7..6b938f1cb9 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -168,7 +168,18 @@ class MessageCache { * @return ParserOptions */ function getParserOptions() { + global $wgFullyInitialised, $wgContLang; + if ( !$this->mParserOptions ) { + if ( !$wgFullyInitialised ) { + // $wgUser isn't unstubbable yet, so don't try to get a + // ParserOptions for it. And don't cache this ParserOptions + // either. + $po = new ParserOptions( new User, $wgContLang ); + $po->setEditSection( false ); + return $po; + } + $this->mParserOptions = new ParserOptions; $this->mParserOptions->setEditSection( false ); }