ID: 31181 Updated by: [EMAIL PROTECTED] Reported By: shustrik at softech dot lv -Status: Open +Status: Bogus Bug Type: Zend Engine 2 problem Operating System: Linux 2.4.20 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. Previous Comments: ------------------------------------------------------------------------ [2004-12-18 16:02:17] shustrik at softech dot lv Description: ------------ Apparently, the foreach loop such as "foreach ($array as $value)" puts some kind of index-value array into $value. This differs from what the documentation says and does not seem to appear in changelog or make any sense. The code below produces different results on 4.3.9 and 4.3.10 Reproduce code: --------------- <?php $a = array( 'ab' => array( 'a' => 1, 'b' => 2 ), 'cd' => array( 'c' => 3, 'd' => 4 ) ); foreach ($a as $key => $array) { echo '<br />key ' . $key . ', array: '; var_dump($array); foreach ($array as $datafield) { echo '<br />key ' . $key . ', subarray element: '; var_dump($datafield); } } ?> Expected result: ---------------- PHP 4.3.9: key ab, array: Array ( [a] => 1 [b] => 2 ) key ab, subarray element: 1 key ab, subarray element: 2 key cd, array: Array ( [c] => 3 [d] => 4 ) key cd, subarray element: 3 key cd, subarray element: 4 Actual result: -------------- PHP 4.3.10: key ab, array: Array ( [a] => 1 [b] => 2 ) key ab, subarray element: Array ( [0] => 1 [1] => a ) key ab, subarray element: Array ( [0] => 2 [1] => b ) key cd, array: Array ( [c] => 3 [d] => 4 ) key cd, subarray element: Array ( [0] => 3 [1] => c ) key cd, subarray element: Array ( [0] => 4 [1] => d ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31181&edit=1