#27923 [Ver->Csd]: foreach() with references broken when iterating only over value
ID: 27923
Updated by: andi@php.net
Reported By: adam at trachtenberg dot com
-Status: Verified
+Status: Closed
Bug Type: Zend Engine 2 problem
Operating System: *
PHP Version: 5CVS-2004-04-13
Assigned To: andi
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2004-04-23 20:42:00] amt@php.net
Cannot reproduce on Linux or Mac OS X with snapshots,
but bug continues to exist on Mac OS X when building
from CVS.
------------------------------------------------------------------------
[2004-04-23 01:44:54] amt@php.net
Any chance of this getting into RC2?
------------------------------------------------------------------------
[2004-04-12 19:43:25] sniper@php.net
See also bug #27964 (a bit different case but same errors :)
------------------------------------------------------------------------
[2004-04-12 19:40:07] adam at trachtenberg dot com
Jesus. Sometimes I reduce the test case too far. :)
$a = array('foo', 'bar');
foreach ($a as &$value) {
$value = strtoupper($value);
}
print_r($a);
$a should have FOO and BAR, as it works okay if you do:
foreach ($a as $k => &$value) {
$value = strtoupper($value);
}
But PHP gives an error on the first example w/o my
patch.
(At least I hope it still does, I need to recompile PHP
to triple check.)
------------------------------------------------------------------------
[2004-04-12 19:31:58] sniper@php.net
your example doesn't have any references in it..? (and it works fine
when I replace the last ) with } :)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/27923
--
Edit this bug report at http://bugs.php.net/?id=27923&edit=1
Thread (7 messages)