#35491 [Opn->Bgs]: Nice missbehaviour using arrays in functions.
| From: | tony2001@php.net | Date: | Wed, 30 Nov 2005 14:14:12 +0000 |
| Subject: | #35491 [Opn->Bgs]: Nice missbehaviour using arrays in functions. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-89478@lists.php.net to get a copy of this message | ||
ID: 35491
Updated by: tony2001@php.net
Reported By: stephan dot skusa at lippe-net dot de
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Linux
PHP Version: 4.4.1
New Comment:
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same.
Thank you for your interest in PHP.
Reported a gazillion of times before.
Fixed long time ago.
Previous Comments:
------------------------------------------------------------------------
[2005-11-30 15:02:34] stephan dot skusa at lippe-net dot de
Description:
------------
The call of test() results into an endless loop. The first for() works
well, the for() in the function is the problem.
And the Problem appears even if the first for() is left out.
Reproduce code:
---------------
<?PHP
$arr = array ('a' => 1, 'c' => 2);
for (reset ($arr); $key = key ($arr); next ($arr)) {
echo $key;
}
echo "PING";
function test() {
global $arr;
for (reset ($arr); $key = key ($arr); next ($arr)) {
echo $key;
}
}
test();
?>
Expected result:
----------------
Output of "acPINGac"
Actual result:
--------------
Endless Loop
Output of "acPINGaaaaaaaaaaaaa ... to be continued"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35491&edit=1