#24396 [NEW]: foreach ($k=>$v), the key $k is missing

From: Date: Mon, 30 Jun 2003 04:48:26 +0000
Subject: #24396 [NEW]: foreach ($k=>$v), the key $k is missing
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-42808@lists.php.net to get a copy of this message
From: jlim at natsoft dot com Operating system: Windows XP PHP version: 5.0.0b1 (beta1) PHP Bug Type: Scripting Engine problem Bug description: foreach ($k=>$v), the key $k is missing Description: ------------ The following script below fails (missing $k). Reproduce code: --------------- <?php error_reporting(E_ALL); echo PHP_VERSION."<br>"; print_r($_GET); foreach($_GET as $k=>$v) { global $$k; print " ($k=>$v) "; $$k = $v; } ?> Expected result: ---------------- 5.0.0b1 Array ( [a] => 1 [b] => 2 [c] => 3 ) (a=>1) (b=>2) (c=>3) Actual result: -------------- 5.0.0b1 Array ( [a] => 1 [b] => 2 [c] => 3 ) (=>1) (=>2) (=>3) -- Edit bug report at http://bugs.php.net/?id=24396&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=24396&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=24396&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24396&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24396&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24396&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=24396&r=support Expected behavior: http://bugs.php.net/fix.php?id=24396&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=24396&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=24396&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24396&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24396&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24396&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24396&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=24396&r=gnused

« previous php.bugs (#42808) next »