r102335 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102334‎ | r102335 | r102336 >
Date:22:15, 7 November 2011
Author:happy-melon
Status:ok (Comments)
Tags:
Comment:
Follow-up r102334: odd that this minus sign (yes, copied from a diff) was actually harmless. Also explicitly define a variable that would otherwise be lazily initialised to zero but about which my IDE complains.
Modified paths:
  • /trunk/phase3/includes/specials/SpecialEditWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialEditWatchlist.php
@@ -379,6 +379,7 @@
380380 global $wgContLang;
381381
382382 $fields = array();
 383+ $count = 0;
383384
384385 $haveInvalidNamespaces = false;
385386 foreach( $this->getWatchlistInfo() as $namespace => $pages ){
@@ -413,7 +414,7 @@
414415 $nsText = $ns == NS_MAIN
415416 ? wfMsgHtml( 'blanknamespace' )
416417 : htmlspecialchars( $wgContLang->getFormattedNsText( $ns ) );
417 - -$this->toc .= Linker::tocLine( "mw-htmlform-{$data['section']}", $nsText, ++$tocLength, 1 ) . Linker::tocLineEnd();
 418+ $this->toc .= Linker::tocLine( "mw-htmlform-{$data['section']}", $nsText, ++$tocLength, 1 ) . Linker::tocLineEnd();
418419 }
419420 $this->toc = Linker::tocList( $this->toc );
420421 } else {

Follow-up revisions

RevisionCommit summaryAuthorDate
r102546REL1_18 MFT r102334, r102335reedy17:40, 9 November 2011
r1025981.18wmf1 MFT r101445, r101464, r101666, r101802, r101860, r101990, r102297, r...reedy23:20, 9 November 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102334(bug 31502) (follow-up r84718) Restore ToC to Special:EditWatchlist if there ...happy-melon22:11, 7 November 2011

Comments

#Comment by Catrope (talk | contribs)   12:59, 8 November 2011

PHP was probably interpreting it as -($this->toc .= blah), which would mean blah is appended to $this->toc, then the new value of $this->toc is returned from the parenthesized expression, then that value is cast to an integer (probably zero), then that value is negated (-0 = 0), then that value is discarded because it's not being assigned to anything.

Status & tagging log