From: richy at smilingsouls dot net Operating system: Windows XP Home PHP version: 4.3.3 PHP Bug Type: *Programming Data Structures Bug description: for does not execute from within foreach
Description: ------------ I have tried several variations of trying to use a for loop from within a foreach. In no case did the for loop execute. I have no idea if this is simply not allowed, or a bug. But it has frustrated me enough to report it! This works neither on my home dev. server (Xitami, Windows XP, PHP 4.3.3 R4) or on my remote ISP which sports some flavor of Unix. See server config at http://www.smilingsouls.net/phpinfo.php Reproduce code: --------------- function foo() { $foo[1] = 'test1'; $foo[2] = 'test2'; foreach($foo as $key => $value) { for($d = 0; $d == 10; $d++) {echo $d;} } } function foo2() { $foo[1] = 'test1'; $foo[2] = 'test2'; foreach($foo as $key => $value) { loop_it(); } } function loop_it() { for($d = 0; $d == 10; $d++) {echo $d;} } $foo[1] = 'test1'; $foo[2] = 'test2'; foreach($foo as $key => $value) { loop_it(); } Expected result: ---------------- each should output: 012345678910 012345678910 Actual result: -------------- blank, nothing! -- Edit bug report at http://bugs.php.net/?id=25699&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25699&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25699&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=25699&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=25699&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=25699&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=25699&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=25699&r=support Expected behavior: http://bugs.php.net/fix.php?id=25699&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=25699&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=25699&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=25699&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25699&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=25699&r=dst IIS Stability: http://bugs.php.net/fix.php?id=25699&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=25699&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=25699&r=float