ID:               31165
 Updated by:       [EMAIL PROTECTED]
 Reported By:      abajolet at toiletoine dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         Arrays related
 Operating System: Linux 2.6.9
 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.

Get rid of ZendOptimizer or upgrade it, and this problem will go away.


Previous Comments:
------------------------------------------------------------------------

[2004-12-18 00:41:12] abajolet at toiletoine dot net

Description:
------------
Hello,

between php 4.3.9 and php 4.3.10, foreach() changes its behavior (see
code below).

The ./configure and linked libraries are exactly the same in the two
versions :

'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs'
'--with-config-file-path=/etc' '--with-ming' '--with-ldap'
'--with-mysql' '--with-pgsql' '--with-gd' '--with-jpeg-dir=../jpeg-6b'
'--with-png-dir=../libpng-1.2.2'
'--with-freetype-dir=../freetype-2.1.7' '--with-t1lib'
'--enable-bcmath' '--enable-calendar' '--enable-trans-sid'
'--with-mcrypt' '--with-mhash' '--with-regex=php' '--with-zlib'
'--enable-ftp' '--with-snmp' '--with-openssl=/usr/local/ssl'
'--enable-sockets' '--enable-track-vars' '--enable-magic-quotes'
'--enable-xslt' '--with-xslt-sablot' '--with-iconv=/usr/local'
'--enable-sigchild' '--enable-inline-optimization'
'--with-mm=/usr/local/mm' '--enable-sysvsem' '--enable-sysvshm'
'--enable-sysvmsg' '--enable-pcntl'


Regards,
Antoine Bajolet

Reproduce code:
---------------
<?php
print phpversion() . '<br/>';

$array['foo'] = array('one'=>'two',
                       'three'=>'for');
$array['bar'] = array('five'=>'six',
                       'seven'=>'eight');

print_r($array); print '<br/>';

foreach ($array as $sub){
    foreach($sub as $key => $value) {
        print $key . '=>' .$value .'<br/>';
    }
}
?>

Expected result:
----------------
4.3.9
Array ( [foo] => Array ( [one] => two [three] => for ) [bar] => Array (
[five] => six [seven] => eight ) )
one=>two
three=>for
five=>six
seven=>eight

Actual result:
--------------
4.3.10
Array ( [foo] => Array ( [one] => two [three] => for ) [bar] => Array (
[five] => six [seven] => eight ) )
0=>Array
1=>foo
0=>Array
1=>bar


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31165&edit=1

Reply via email to