ID: 3462
Updated by: derick@php.net
Reported By: leon@leonatkinson.com
-Status: Analyzed
+Status: Won't fix
Bug Type: Feature/Change Request
Operating System: all
PHP Version: 4.0 Beta 3
Previous Comments:
------------------------------------------------------------------------
[2000-07-31 22:41:22] waldschrott@php.net
Why don´t you let your cache function return an empty array?
I think you should take care about passing foreach() the
right types...
Anyway PHPs handling of conversion unfortunately differs a
lot from function to function and statement to statement.
Thus I really don´t know what to do with this one I´ll mark
it analyzed.
------------------------------------------------------------------------
[2000-02-11 22:38:48] leon@leonatkinson.com
Given the following code:
unset($list);
foreach($list as $value)
{
print($value);
}
and $list is FALSE, PHP is generating an error like
"Non array argument supplied for foreach()". The
variable probably should be promoted to being an
empty array, but I can deal with casting it myself.
Unfortunately, when I do this:
unset($list);
foreach((array)$list as $value)
{
print($value);
}
it runs through the loop once. I know I can get around
this using a while loop, but I'd prefer to use foreach.
If anyone's wondering why the hell I'm looping over an
unset variable, I have a caching function that returns
the contents of a database table. When there are no
rows, it returns the unset static variable.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=3462&edit=1