r60998 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60997‎ | r60998 | r60999 >
Date:02:41, 13 January 2010
Author:mah
Status:reverted (Comments)
Tags:
Comment:
follow-up r60832: make sure $t always ends up a Title.
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -258,15 +258,18 @@
259259 * Set the context title
260260 */
261261 function setTitle( $t ) {
262 - if ( !$t || $t instanceof FakeTitle ) {
263 - $t = Title::newFromText( 'NO TITLE' );
264 - }
265 - // If we still don't have a Title object, make sure we can
266 - // convert whatever we've been passed to a string.
267 - if ( !$t instanceOf Title && is_string( "$t" ) ) {
 262+ if ( $t && !($t instanceOf FakeTitle)
 263+ && !($t instanceOf Title)
 264+ && is_string( "$t" ) ) {
 265+ // If don't have a Title object, make sure we can convert
 266+ // whatever we've been passed to a string.
268267 $t = Title::newFromText( "$t" );
269268 }
270269
 270+ if ( !($t instanceOf Title) ) {
 271+ $t = Title::newFromText( 'NO TITLE' );
 272+ }
 273+
271274 if ( strval( $t->getFragment() ) !== '' ) {
272275 # Strip the fragment to avoid various odd effects
273276 $this->mTitle = clone $t;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r60832follow up r60763...mah08:22, 8 January 2010

Comments

#Comment by Tim Starling (talk | contribs)   08:31, 20 January 2010

Was reverted in r61101.

Status & tagging log