#33719 [NEW]: foreach clash

From: Date: Sat, 16 Jul 2005 03:11:45 +0000
Subject: #33719 [NEW]: foreach clash
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-81917@lists.php.net to get a copy of this message
From: s dot masugata at digicom dot dnp dot co dot jp Operating system: Solaris8 PHP version: 4.4.0 PHP Bug Type: *General Issues Bug description: foreach clash Description: ------------ KEY and VALUE of foreach are made the duplicate variable, strange operation is done. Reproduce code: --------------- <?php $arr = array("1","123","12345"); foreach ( $arr as $val => $val ) { // echo "debug {$val}\n"; // this comment is removed, stranger operation is done. } print_r( $arr ); ?> Expected result: ---------------- Array ( [0] => 1 [1] => 123 [2] => 12345 ) Actual result: -------------- Array ( [0] => 1 [1] => 2 [2] => ) /usr/local/src/php-4.4.0/Zend/zend_execute.c(2436) : Freeing 0x0838B164 (12 bytes), script=f.php -- Edit bug report at http://bugs.php.net/?id=33719&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33719&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33719&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33719&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33719&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33719&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33719&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33719&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33719&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33719&r=support Expected behavior: http://bugs.php.net/fix.php?id=33719&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33719&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33719&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33719&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33719&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33719&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33719&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33719&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33719&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33719&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33719&r=mysqlcfg

« previous php.bugs (#81917) next »