#33287 [Opn->Fbk]: foreach does not give errors
| From: | tony2001@php.net | Date: | Fri, 10 Jun 2005 09:28:50 +0000 |
| Subject: | #33287 [Opn->Fbk]: foreach does not give errors | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-80122@lists.php.net to get a copy of this message | ||
ID: 33287
Updated by: tony2001@php.net
Reported By: chris at deskpro dot com
-Status: Open
+Status: Feedback
Bug Type: Arrays related
Operating System: Win/MacOS linux untested
PHP Version: 4.3.11
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2005-06-09 22:11:40] chris at deskpro dot com
Description:
------------
This is a repost of 33264
33264 was closed because it was said the bug is the same
as 31114. They are however completly different.
31114 is about foreach where the $key and $value are the
same:
foreach ($array AS $key => $key)
which should, perhaps issue a warning.
However, 33264 is about foreach not issuing an error
when you try and loop on an unset variable or a string
e.g.:
$array = '';
foreach ($array AS $value) {
this should, and used to issue an error (I think it was
fatal). It not longer does.
The manual even suggests this error is not preventable
with a @, but not it dosen't appear at all.
So this is both a real bug and important.
Reproduce code:
---------------
<?php
error_reporting(E_ALL);
foreach ($a AS $b) {
}
?>
Expected result:
----------------
Error about $a not being an array.
Actual result:
--------------
No error.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33287&edit=1