From b70eeefc94fbdad617a0603fa6b49a0b63621b8f Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Wed, 14 Sep 2011 12:32:22 +0000 Subject: [PATCH] Followup r86304, guard against $title AND $wgTitle being null Add profiling too --- includes/cache/MessageCache.php | 8 ++++++++ 1 file changed, 8 insertions(+) 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; } -- 2.20.1