ID:               41088
 User updated by:  barryd dot it at gmail dot com
 Reported By:      barryd dot it at gmail dot com
-Status:           Bogus
+Status:           Open
 Bug Type:         Unknown/Other Function
 Operating System: Irrelevent
 PHP Version:      5.2.1
 New Comment:

Please review this again...


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

[2007-04-14 23:42:18] barryd dot it at gmail dot com

<?php
  $func = create_function('', 'echo "this is the break\n";');
  while(1) {
    while(1) {
      sleep(1);
      $func();
    }
    echo 'hello world' . "\n";
  }
  exit();
?>

The result is a continuous loop of 'this is a break\n', which means
that the echo function is being performed after the variable defintion,
which would mean that any other function should occure in the same
result!

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

[2007-04-14 23:34:44] barryd dot it at gmail dot com

This is not a problem with the scope... If a variable can have the
definition of a create_function('', 'echo "This is where the break
is\n"'); Then technically speaking, a break(); should be existent from
within this function, and not have actually resulted/occured without the
variable function being called for...

Lamens term: If I can tell php to return a value, before the required
moment for that result, then a break(); function should occure in the
same means... What is so troubling about this idea?

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

[2007-04-14 23:15:49] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

A function has another execution scope.

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

[2007-04-14 23:08:49] barryd dot it at gmail dot com

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 this bug report at http://bugs.php.net/?id=41088&edit=1

Reply via email to