#32670 [NEW]: foreach sets source variable if not already set and does not issue warning
| From: | cmoore at iyd dot com | Date: | Mon, 11 Apr 2005 14:07:25 +0000 |
| Subject: | #32670 [NEW]: foreach sets source variable if not already set and does not issue warning | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-76637@lists.php.net to get a copy of this message | ||
From: cmoore at iyd dot com
Operating system: Linux
PHP version: 4.3.11
PHP Bug Type: Arrays related
Bug description: foreach sets source variable if not already set and does not issue warning
Description:
------------
prior versions of php (4.3.10 tested) will issue a warning if an unset
variable is passed to foreach(). even with error_reporting(E_ALL), this
one will not warn. the warning would be nice to see with the same level of
error reporting that if() warns at.
Reproduce code:
---------------
<?
error_reporting(E_ALL);
foreach($check as $test)
;
Expected result:
----------------
Warning: Invalid argument supplied for foreach() in test.php on line 3
Actual result:
--------------
there is no result in 4.3.11
--
Edit bug report at http://bugs.php.net/?id=32670&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32670&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32670&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32670&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32670&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32670&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32670&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32670&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32670&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32670&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32670&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32670&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32670&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32670&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32670&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32670&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32670&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32670&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32670&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32670&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32670&r=mysqlcfg