#50582 [Opn->Bgs]: Incorrect foreach iteration by value after iteration by reference
| From: | pierrick@php.net | Date: | Sat, 26 Dec 2009 23:25:35 +0000 |
| Subject: | #50582 [Opn->Bgs]: Incorrect foreach iteration by value after iteration by reference | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-146128@lists.php.net to get a copy of this message | ||
ID: 50582
Updated by: pierrick@php.net
Reported By: mwacker at cornellsun dot com
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Ubuntu 9.10
PHP Version: 5.3.1
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Previous Comments:
------------------------------------------------------------------------
[2009-12-26 22:48:18] mwacker at cornellsun dot com
Description:
------------
A variable acts weird when it is used as a reference variable inside a
foreach loop and then as a regular variable inside a foreach loop.
(Originally seen in 5.2.10-2ubuntu6.3, repro'd in a fresh 5.3.1
install)
Reproduce code:
---------------
$ii = array(1, 2, 3);
foreach ($ii as &$i) echo $i;
foreach ($ii as $i) echo $i;
Expected result:
----------------
123123
Actual result:
--------------
123122
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50582&edit=1