Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -258,15 +258,18 @@ |
259 | 259 | * Set the context title |
260 | 260 | */ |
261 | 261 | 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. |
268 | 267 | $t = Title::newFromText( "$t" ); |
269 | 268 | } |
270 | 269 | |
| 270 | + if ( !($t instanceOf Title) ) { |
| 271 | + $t = Title::newFromText( 'NO TITLE' ); |
| 272 | + } |
| 273 | + |
271 | 274 | if ( strval( $t->getFragment() ) !== '' ) { |
272 | 275 | # Strip the fragment to avoid various odd effects |
273 | 276 | $this->mTitle = clone $t; |