ID: 40705
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Open
+Status: Assigned
Bug Type: Arrays related
Operating System: Irrelevant
PHP Version: 5.2.1
-Assigned To:
+Assigned To: dmitry
Previous Comments:
------------------------------------------------------------------------
[2007-03-03 12:31:20] [EMAIL PROTECTED]
Description:
------------
If an array is passed by value to the function and is iterated over
within said function, the "internal pointer" of the original array is
moved.
Reproduce code:
---------------
function doForeach($array)
{
foreach ($array as $k => $v) {
// do stuff
}
}
$foo = array('foo', 'bar', 'baz');
doForeach($foo);
var_dump(key($foo));
Expected result:
----------------
int(0) (returned by versions prior to 5.2.1)
Actual result:
--------------
NULL (returned by version 5.2.1 and current 5.2 snapshot)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40705&edit=1