From: Mark A. Hershberger Date: Wed, 13 Jan 2010 02:41:58 +0000 (+0000) Subject: follow-up r60832: make sure $t always ends up a Title. X-Git-Tag: 1.31.0-rc.0~38296 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=a33a9ca68101ba7ead628d82a99513d32e853dff;p=lhc%2Fweb%2Fwiklou.git follow-up r60832: make sure $t always ends up a Title. --- 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;