#35491 [Bgs]: Nice missbehaviour using arrays in functions.
| From: | tony2001@php.net | Date: | Wed, 30 Nov 2005 14:44:12 +0000 |
| Subject: | #35491 [Bgs]: Nice missbehaviour using arrays in functions. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-89486@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: Bogus
Bug Type: Arrays related
Operating System: Linux
PHP Version: 4.4.1
New Comment:
http://bugs.php.net/bug.php?id=35444
http://bugs.php.net/bug.php?id=35374
http://bugs.php.net/bug.php?id=35095
http://bugs.php.net/bug.php?id=35092
http://bugs.php.net/bug.php?id=35084
http://bugs.php.net/bug.php?id=35067
http://bugs.php.net/bug.php?id=35084
Most likely you didn't even try to find it.
Previous Comments:
------------------------------------------------------------------------
[2005-11-30 15:37:42] stephan dot skusa at lippe-net dot de
I didn't found an equal bug description.
Not everybody describes a bug the same way, maybe that's the reason!
------------------------------------------------------------------------
[2005-11-30 15:14:12] tony2001@php.net
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.
------------------------------------------------------------------------
[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