#24758 [Opn->Fbk]: foreach() is broken

From: Date: Tue, 22 Jul 2003 21:53:44 +0000
Subject: #24758 [Opn->Fbk]: foreach() is broken
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-44539@lists.php.net to get a copy of this message
ID: 24758 Updated by: helly@php.net Reported By: vma1 at abv dot bg -Status: Open +Status: Feedback Bug Type: Arrays related Operating System: Slackware Linux 9.0 PHP Version: 5CVS-2003-07-22 (dev) New Comment: Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip For me it works, so i think my latest commit fixed it. $ php -r '$ar=array(0=>"a",1=>"b");foreach($ar as $k=>$v) echo "$k=>$v\n";' 0=>a 1=>b Previous Comments: ------------------------------------------------------------------------ [2003-07-22 16:33:19] vma1 at abv dot bg Description: ------------ The last CVS version php5-200307221730 has broken handling of arrays in foreach() structure. When enumerating array keys the values cannot be accessed. Reproduce code: --------------- $list = array (); $list ["0"] = "abc"; foreach ($list as $key => $unused) { printf ("%s<br>", $list [$key]); } Expected result: ---------------- abc Actual result: -------------- Notice: Undefined index: 0 in /usr/local/apache/site/htdocs/bug.php on line 5 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24758&edit=1

« previous php.bugs (#44539) next »