ID: 35084
User updated by: margus at zone dot ee
Reported By: margus at zone dot ee
Status: Open
Bug Type: Scripting Engine problem
-Operating System: 4.4.1
+Operating System: SuSE 9.0
PHP Version: 4.4.1
New Comment:
OS is SuSE 9.0
Previous Comments:
------------------------------------------------------------------------
[2005-11-03 11:51:49] margus at zone dot ee
Description:
------------
I have reference to array and iterating through the array using
current()/next() loop
The problem is, that $element = current($arr_ref) returns always the
first element in array regardless of multiple next($arr_ref) calls
before current(...)
-----
It worked in php4.4.0. At the moment the only workaround is to replace
everywhere in code:
$element = current ($arr_ref)
to
$element = current(& $arr_ref);
Reproduce code:
---------------
$a = array('foot', 'bike');
reset ($a);
next($a);
echo "A:" . current ($a) . "<BR>";
$b =& $a;
reset ($b);
next($b);
echo "B:" . current ($b) . "<BR>";
Expected result:
----------------
A:bike
B:bike
Actual result:
--------------
A:bike
B:foot
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35084&edit=1