diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 545a46f63c4..87468bd2bf0 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -121,7 +121,7 @@ class MediaWiki { * @return Title */ public function getTitle() { - if ( $this->context->getTitle() === null ) { + if ( !$this->context->hasTitle() ) { $this->context->setTitle( $this->parseTitle() ); } return $this->context->getTitle(); diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php index 952af8cdeb0..b1bebe7c2b1 100644 --- a/includes/context/RequestContext.php +++ b/includes/context/RequestContext.php @@ -146,6 +146,16 @@ class RequestContext implements IContextSource { return $this->title; } + /** + * Check, if a Title object is set + * + * @since 1.25 + * @return bool + */ + public function hasTitle() { + return $this->title !== null; + } + /** * Check whether a WikiPage object can be get with getWikiPage(). * Callers should expect that an exception is thrown from getWikiPage()