From 4ae1ef34c199b269db9aec94a569df0ffb111d42 Mon Sep 17 00:00:00 2001 From: Robin Pepermans Date: Wed, 7 Sep 2011 04:05:37 +0000 Subject: [PATCH] Per r90858 CR, throw MW exception on missing title context --- includes/parser/Parser.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 2e8a07dc73..02cef7d026 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -690,14 +690,16 @@ class Parser { * @return Language */ function getFunctionLang() { - global $wgLang; - $target = $this->mOptions->getTargetLanguage(); if ( $target !== null ) { return $target; - } else { - return $this->mOptions->getInterfaceMessage() ? $wgLang : $this->mTitle->getPageLanguage(); + } elseif( $this->mOptions->getInterfaceMessage() ) { + global $wgLang; + return $wgLang; + } elseif( is_null( $this->mTitle ) ) { + throw new MWException( __METHOD__.': $this->mTitle is null' ); } + return $this->mTitle->getPageLanguage(); } /** -- 2.20.1