#30914 [NEW]: foreach returns the wrong value

From: Date: Fri, 26 Nov 2004 15:02:22 +0000
Subject: #30914 [NEW]: foreach returns the wrong value
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-69488@lists.php.net to get a copy of this message
From: phpbug at billmann-edv dot net Operating system: Linux PHP version: 4.3.10RC1 PHP Bug Type: Arrays related Bug description: foreach returns the wrong value Description: ------------ foreach returns the wrong results. Taking a look at the simple example code and the result should make any more explanations unnecessary... ;-) Reproduce code: --------------- foreach ( array ( 1 ) as $data ) { var_dump ( $data ); } Expected result: ---------------- int(1) Actual result: -------------- array(2) { [0]=> int(1) [1]=> int(0) } -- Edit bug report at http://bugs.php.net/?id=30914&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30914&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30914&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30914&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30914&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30914&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30914&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30914&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30914&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30914&r=support Expected behavior: http://bugs.php.net/fix.php?id=30914&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30914&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30914&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30914&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30914&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30914&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30914&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30914&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30914&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30914&r=mysqlcfg

« previous php.bugs (#69488) next »