From a33a9ca68101ba7ead628d82a99513d32e853dff Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Wed, 13 Jan 2010 02:41:58 +0000 Subject: [PATCH] follow-up r60832: make sure $t always ends up a Title. --- includes/parser/Parser.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index f1ef4fb906..39cbed4f5d 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -258,15 +258,18 @@ class Parser * Set the context title */ function setTitle( $t ) { - if ( !$t || $t instanceof FakeTitle ) { - $t = Title::newFromText( 'NO TITLE' ); - } - // If we still don't have a Title object, make sure we can - // convert whatever we've been passed to a string. - if ( !$t instanceOf Title && is_string( "$t" ) ) { + if ( $t && !($t instanceOf FakeTitle) + && !($t instanceOf Title) + && is_string( "$t" ) ) { + // If don't have a Title object, make sure we can convert + // whatever we've been passed to a string. $t = Title::newFromText( "$t" ); } + if ( !($t instanceOf Title) ) { + $t = Title::newFromText( 'NO TITLE' ); + } + if ( strval( $t->getFragment() ) !== '' ) { # Strip the fragment to avoid various odd effects $this->mTitle = clone $t; -- 2.20.1