#47388 [Opn->Bgs]: Array Foreach Reference Broken
| From: | derick@php.net | Date: | Mon, 16 Feb 2009 19:15:59 +0000 |
| Subject: | #47388 [Opn->Bgs]: Array Foreach Reference Broken | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-133884@lists.php.net to get a copy of this message | ||
ID: 47388
Updated by: derick@php.net
Reported By: martin at itmission dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows XP
PHP Version: 5.3.0beta1
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
.
Previous Comments:
------------------------------------------------------------------------
[2009-02-16 18:57:13] martin at itmission dot com
Also happens in 5.2.8
------------------------------------------------------------------------
[2009-02-16 18:56:12] martin at itmission dot com
Changed category
------------------------------------------------------------------------
[2009-02-14 19:47:28] martin at itmission dot com
Description:
------------
When using foreach on an array using the reference syntax, stuff breaks
later.
Reproduce code:
---------------
<?php
$a = array(0, 1, 2, 3, 4);
foreach($a as $k => &$v)
{
$v++;
}
foreach($a as $k => $v)
{
echo("$k => $v\n");
}
?>
Expected result:
----------------
0 => 1
1 => 2
2 => 3
3 => 4
4 => 5
Actual result:
--------------
0 => 1
1 => 2
2 => 3
3 => 4
4 => 4
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47388&edit=1