if ( !$this->mParserOptions ) {
if ( !$this->getContext()->getUser()->isSafeToLoad() ) {
- // $wgUser isn't loaded yet, so don't try to get a
+ // $wgUser isn't unstubbable yet, so don't try to get a
// ParserOptions for it. And don't cache this ParserOptions
// either.
$po = ParserOptions::newFromAnon();
$limit2 = $limit2 ?: self::LIMIT_SML2;
// This is a bit awkward, but we want to avoid calling canApiHighLimits()
- // because it loads the user object
+ // because it unstubs $wgUser
$valuesList = $this->explodeMultiValue( $value, $limit2 + 1 );
$sizeLimit = count( $valuesList ) > $limit1 && $this->mMainModule->canApiHighLimits()
? $limit2
if ( !$this->mParserOptions ) {
if ( !$wgUser->isSafeToLoad() ) {
- // $wgUser isn't loaded yet, so don't try to get a
+ // $wgUser isn't unstubbable yet, so don't try to get a
// ParserOptions for it. And don't cache this ParserOptions
// either.
$po = ParserOptions::newFromAnon();
* the site language.
*
* @see MessageCache::get
- * @param Language $lang Preferred language
+ * @param Language|StubObject $lang Preferred language
* @param string $lckey Lowercase key for the message (as for localisation cache)
* @param bool $useDB Whether to include messages from the wiki database
* @return string|bool The message, or false if not found
* Given a language, try and fetch messages from that language and its fallbacks.
*
* @see MessageCache::get
- * @param Language $lang Preferred language
+ * @param Language|StubObject $lang Preferred language
* @param string $lckey Lowercase key for the message (as for localisation cache)
* @param bool $useDB Whether to include messages from the wiki database
* @param bool[] $alreadyTried Contains true for each language that has been tried already
}
if ( $lang === null ) {
global $wgLang;
+ if ( !StubObject::isRealObject( $wgLang ) ) {
+ $wgLang->_unstub();
+ }
$lang = $wgLang;
}
$this->initialiseFromUser( $user, $lang );
*
* @since 1.30
* @param User|null $user
- * @param Language|null $lang
+ * @param Language|StubObject|null $lang
* @return ParserOptions
*/
public static function newCanonical( User $user = null, $lang = null ) {