From:             rave235 at gmail dot com
Operating system: winxp
PHP version:      5.2.1
PHP Bug Type:     Scripting Engine problem
Bug description:  nested foreach break -- infinite loop - serious

Description:
------------
i use just build i downloaded from site (5.2.1) no exts, no optimizers.
it seem the $a,$b keep same internal pointer, this is quite serious error
cos $b=$a should create separate array copy and it does but without the
inner pointer.
if you replace $b=$a with $b=array(1,2,3); it works as expected

this was reported and ignored by someone on solaris before as well--
#40608


Reproduce code:
---------------
$a=array(1,2,3);
$b=$a;
        
foreach($a as $A)
{
     foreach($b as $B)
      {
        echo "$A,$B\n";
        break;
      }
}

Expected result:
----------------
1,1
2,1
3,1

Actual result:
--------------
1,1
2,1
3,1
2,1
3,1
2,1
3,1
--infinite-

-- 
Edit bug report at http://bugs.php.net/?id=40768&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40768&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40768&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40768&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40768&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40768&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40768&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40768&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40768&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40768&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40768&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40768&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40768&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40768&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40768&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40768&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40768&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40768&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40768&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40768&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40768&r=mysqlcfg

Reply via email to