From: cow at neondragon dot net
Operating system: Windows XP
PHP version: 4.3.10RC1
PHP Bug Type: Arrays related
Bug description: Incorrect foreach() behavior
Description:
------------
I'm pretty sure this isn't supposed to happen - it didn't happen with
earlier versions of PHP, and nothing in the manual documents it. It
happens with the RC of 4.3.10.
Reproduce code:
---------------
<?php
$foo = array(1,2,3);
foreach ($foo as $i) {
print_r($i);
}
/*
Result of code:
Array ( [0] => 1 [1] => 0 )
Array ( [0] => 2 [1] => 1 )
Array ( [0] => 3 [1] => 2 )
*/
?>
Expected result:
----------------
The string 1, then string 2, then string 3 - not arrays each time.
--
Edit bug report at http://bugs.php.net/?id=30968&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30968&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=30968&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=30968&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30968&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30968&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30968&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30968&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30968&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30968&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30968&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=30968&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=30968&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30968&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30968&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30968&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30968&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30968&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30968&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30968&r=mysqlcfg