PHP 4.0 Bug #5704: two nested foreach loops on the same array stop prematurely.
| From: | bailey at mcs dot anl dot gov | Date: | Thu, 20 Jul 2000 16:39:13 +0000 |
| Subject: | PHP 4.0 Bug #5704: two nested foreach loops on the same array stop prematurely. | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-25241@lists.php.net to get a copy of this message | ||
From: bailey@mcs.anl.gov
Operating system: Redhat Linux 6.1, kernel 2.2.15
PHP version: 4.0.0
PHP Bug Type: Misbehaving function
Bug description: two nested foreach loops on the same array stop prematurely.
<?php
$config = array( 1 => "foo",
2 => "bar",
3 => "far",
);
foreach ($config as $resource => $value) {
echo $resource, ":<br>\n";
foreach ($config as $resource2 => $value2) {
echo "$resource2<br>\n";
}
}
?>
this script will display the following webpage:
1:
1
2
3
It should display this:
1:
1
2
3
2:
1
2
3
3:
1
2
3
This is a rather severe error, I think.
We have a pretty basic setup, no obscure modules compiled in or anything.
Thanks,
Alan