#35270 [NEW]: copying an array no longer resets the index

From: Date: Fri, 18 Nov 2005 04:15:11 +0000
Subject: #35270 [NEW]: copying an array no longer resets the index
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969370901@lists.php.net to get a copy of this message
From: andrej at blueshoes dot org Operating system: windows PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: copying an array no longer resets the index Description: ------------ the documentation for each http://www.php.net/manual/en/function.each.php has a caution which was true for php up to 4.3.11, but it's not for 4.4.1 anymore. Reproduce code: --------------- $array = array('a', 'b', 'c', 'd', 'e', 'f', 'g'); $breakAt = 3; $i=0; while (list($key, $val) = each($array)) { if ($i > $breakAt) break; $i++; } $brray = $array; $aCurrent = current($array); $bCurrent = current($brray); $actual = $aCurrent; $expected = 'a'; $this->assertEquals($expected, $actual, "failed? could be a good thing. check the code."); $actual = $bCurrent; $expected = 'f'; $this->assertEquals($expected, $actual, "failed? could be a good thing."); Expected result: ---------------- a or f Actual result: -------------- a or f -- Edit bug report at http://bugs.php.net/?id=35270&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35270&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=35270&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=35270&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=35270&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35270&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35270&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35270&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35270&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35270&r=support Expected behavior: http://bugs.php.net/fix.php?id=35270&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35270&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35270&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35270&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35270&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35270&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35270&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35270&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35270&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35270&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35270&r=mysqlcfg

« previous php.doc (#969370901) next »