r44119 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44118‎ | r44119 | r44120 >
Date:17:02, 1 December 2008
Author:aaron
Status:reverted (Comments)
Tags:
Comment:
Remove extract() comment
Modified paths:
  • /trunk/phase3/includes/ChangesList.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ChangesList.php
@@ -339,7 +339,6 @@
340340 wfProfileIn( __METHOD__ );
341341
342342 # Extract DB fields into local scope
343 - // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
344343 extract( $rc->mAttribs );
345344
346345 # Should patrol-related stuff be shown?
@@ -433,7 +432,6 @@
434433 $rc = RCCacheEntry::newFromParent( $baseRC );
435434
436435 # Extract fields from DB into the function scope (rc_xxxx variables)
437 - // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
438436 extract( $rc->mAttribs );
439437 $curIdEq = 'curid=' . $rc_cur_id;
440438
@@ -722,7 +720,6 @@
723721 $r .= '<table cellpadding="0" cellspacing="0" border="0" style="background: none">';
724722 foreach( $block as $rcObj ) {
725723 # Get rc_xxxx variables
726 - // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
727724 extract( $rcObj->mAttribs );
728725
729726 #$r .= '<tr><td valign="top">'.$this->spacerArrow();
@@ -842,7 +839,6 @@
843840 protected function recentChangesBlockLine( $rcObj ) {
844841 global $wgContLang, $wgRCShowChangedSize;
845842 # Get rc_xxxx variables
846 - // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
847843 extract( $rcObj->mAttribs );
848844 $curIdEq = "curid={$rc_cur_id}";
849845

Follow-up revisions

RevisionCommit summaryAuthorDate
r44421Revert r44119 "Remove extract() comment"...brion19:41, 10 December 2008

Comments

#Comment by Brion VIBBER (talk | contribs)   19:41, 10 December 2008

Reverted in r44421.

extract() is pretty much the devil and shouldn't ever be used for safe, legible code because it makes it much more difficult to analyse the code -- you have to run around trying to track down the source of local variables and there's generally a lot of pain.

Removing the FIXME comment isn't a substitute for fixing it. ;)

Status & tagging log