From: Sam Reed Date: Wed, 14 Sep 2011 12:32:22 +0000 (+0000) Subject: Followup r86304, guard against $title AND $wgTitle being null X-Git-Tag: 1.31.0-rc.0~27673 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=b70eeefc94fbdad617a0603fa6b49a0b63621b8f;p=lhc%2Fweb%2Fwiklou.git Followup r86304, guard against $title AND $wgTitle being null Add profiling too --- diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 88b850196e..7255ae7050 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -817,15 +817,23 @@ class MessageCache { $popts->setTargetLanguage( $language ); } + wfProfileIn( __METHOD__ ); if ( !$title || !$title instanceof Title ) { global $wgTitle; $title = $wgTitle; } + // Sometimes $wgTitle isn't set either... + if ( !$title ) { + # It's not uncommon having a null $wgTitle in scripts. See r80898 + # Create a ghost title in such case + $title = Title::newFromText( 'Dwimmerlaik' ); + } $this->mInParser = true; $res = $parser->parse( $text, $title, $popts, $linestart ); $this->mInParser = false; + wfProfileOut( __METHOD__ ); return $res; }