#41088 [NEW]: PHP will not perform break() outside of loop(s)

From: Date: Sat, 14 Apr 2007 23:08:50 +0000
Subject: #41088 [NEW]: PHP will not perform break() outside of loop(s)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-111485@lists.php.net to get a copy of this message
From: barryd dot it at gmail dot com Operating system: Irrelevent PHP version: 5.2.1 PHP Bug Type: Unknown/Other Function Bug description: PHP will not perform break() outside of loop(s) Description: ------------ Ok, I can not perform a break(); by using a $var = create_function('', 'break;'); outside of loop(s). In comparision, I am able to define a variable with the value 'Hello World', and use that variable anywhere within the global script bounderies. That being said and done, the following should be possible... Reproduce code: --------------- <?php $func = create_function('', 'break;'); while(1) { sleep(1); while(1) { $func(); } echo 'hello world' . "\n"; } exit(); ?> Expected result: ---------------- I would expect the result would be a continuous return of Hello world w/ a line break. Now, I understand the first person too respond will say "...the break is resulting not within the boundries of an actual loop...". If you were to have it do echo "this is a break"; ... then the code should not actually be executing, but instead defining its self to a variable, to be used later on in the script. Actual result: -------------- PHP Fatal error: Cannot break/continue 1 level in /home/barryd/Projects/PHP/phpMini/test.php(2) : runtime-created function on line 1 -- Edit bug report at http://bugs.php.net/?id=41088&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41088&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41088&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41088&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41088&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41088&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41088&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41088&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41088&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41088&r=support Expected behavior: http://bugs.php.net/fix.php?id=41088&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41088&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41088&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41088&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41088&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41088&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41088&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41088&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41088&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41088&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41088&r=mysqlcfg

« previous php.bugs (#111485) next »