r68782 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68781‎ | r68782 | r68783 >
Date:17:56, 30 June 2010
Author:werdna
Status:ok (Comments)
Tags:
Comment:
Fix E_NOTICE
Modified paths:
  • /trunk/extensions/LiquidThreads/classes/View.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/classes/View.php
@@ -436,7 +436,7 @@
437437
438438 if ( $this->output->getRedirect() != '' ) {
439439 $redirectTitle = clone $talkpage->getTitle();
440 - if ( $thread ) {
 440+ if ( !empty($thread) ) {
441441 $redirectTitle->setFragment( '#' . $this->anchorName( $thread ) );
442442 }
443443 $this->output->redirect( $this->title->getFullURL() );

Comments

#Comment by MarkAHershberger (talk | contribs)   16:48, 21 July 2010

A proactive programming practice that will keep E_NOTICE and such at bay is to always set the variable to a false value in the scope shared by both blocks of code. That is, add:

$thread = null;

just before

if ( $e->didSave ) {

and you'll avoid the problem entirely. This also avoids awkward !empty() constructs.

Status & tagging log