#31150 [Opn->Bgs]: foreach doesn't work properly

From: Date: Fri, 17 Dec 2004 11:28:06 +0000
Subject: #31150 [Opn->Bgs]: foreach doesn't work properly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-70480@lists.php.net to get a copy of this message
ID: 31150 Updated by: edink@php.net Reported By: cdk at nsk dot ru -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: BSD PHP Version: 4.3.10 New Comment: Do not file bugs when you have Zend extensions (zend_extension=) loaded. Examples are Zend Optimizer, Zend Debugger, Turck MM Cache, APC, Xdebug and ionCube loader. These extensions often modify engine behavior which is not related to PHP itself. Upgrading ZendOptimizer will solve this. Previous Comments: ------------------------------------------------------------------------ [2004-12-17 12:20:28] cdk at nsk dot ru Description: ------------ foreach ($array as $key => $value) if $key is not specified in foreach syntax, then in php 4.3.9 foreach iterated through array values, but in 4.3.10 $value becomes an array in each iteration. Reproduce code: --------------- $array = array(1,2,3); $res = array(); foreach ($array as $value) $res[] = $value; Expected result: ---------------- expecting $res like array(1,2,3) Actual result: -------------- but $res is array(array(1,0), array(2,1), array(3,2)) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31150&edit=1

« previous php.bugs (#70480) next »