Revert r44119 "Remove extract() comment"
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 10 Dec 2008 19:41:20 +0000 (19:41 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 10 Dec 2008 19:41:20 +0000 (19:41 +0000)
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. ;)

includes/ChangesList.php

index e3f6d68..537d6b7 100644 (file)
@@ -339,6 +339,7 @@ class OldChangesList extends ChangesList {
                wfProfileIn( __METHOD__ );
 
                # Extract DB fields into local scope
+               // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
                extract( $rc->mAttribs );
 
                # Should patrol-related stuff be shown?
@@ -432,6 +433,7 @@ class EnhancedChangesList extends ChangesList {
                $rc = RCCacheEntry::newFromParent( $baseRC );
 
                # Extract fields from DB into the function scope (rc_xxxx variables)
+               // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
                extract( $rc->mAttribs );
                $curIdEq = 'curid=' . $rc_cur_id;
 
@@ -720,6 +722,7 @@ class EnhancedChangesList extends ChangesList {
                $r .= '<table cellpadding="0" cellspacing="0"  border="0" style="background: none">';
                foreach( $block as $rcObj ) {
                        # Get rc_xxxx variables
+                       // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
                        extract( $rcObj->mAttribs );
 
                        #$r .= '<tr><td valign="top">'.$this->spacerArrow();
@@ -839,6 +842,7 @@ class EnhancedChangesList extends ChangesList {
        protected function recentChangesBlockLine( $rcObj ) {
                global $wgContLang, $wgRCShowChangedSize;
                # Get rc_xxxx variables
+               // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
                extract( $rcObj->mAttribs );
                $curIdEq = "curid={$rc_cur_id}";