Bug #5408 Updated: foreach() should silently ignore non-array's passed to it
| From: | sander@php.net | Date: | Sun, 11 Nov 2001 19:57:19 +0000 |
| Subject: | Bug #5408 Updated: foreach() should silently ignore non-array's passed to it | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-70162@lists.php.net to get a copy of this message | ||
ID: 5408
Updated by: sander
Reported By: danbeck@dealnews.com
Old Status: Open
Status: Duplicate
Bug Type: Feature/Change Request
Operating System: Redhat 6.1 (Linux 2.2.12-20)
PHP Version: 4.0 Latest CVS (06/07/2000)
New Comment:
Dupe of 3462
Previous Comments:
------------------------------------------------------------------------
[2000-07-06 17:35:42] danbeck@dealnews.com
I feel foreach() should silently ingore any non-array variables passed to it, especially if this was
modeled after the same Perl statement. At the very least, I would like to be able to use the @
notation in front of it so that the script won't die if it doesn't get it's array.
Otherwise, I have to continually use is_array() before using foreach() just to make sure my script
continues to live. Since PHP doesn't make you delcare or initialize variables, you can't
always expect that the variables you give a statement or function will be what they are supposed to
me.
I know that I can just turn my error reporting down, but I do want to see other valid script and
parse errors.
Thanks,
Daniel Beckham
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=5408&edit=1