#45749 [Opn]: interactive mode hangs on simple input

[email protected] ("mazzarelli at gmail dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               45749
 User updated by:  mazzarelli at gmail dot com
 Reported By:      mazzarelli at gmail dot com
 Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: Ubuntu 8.04
 PHP Version:      5.2.6
 New Comment:

In case it wasn't clear, I forgot to mention what seems to be
happening.

In interactive mode, upon reaching the "if (false)" containing a
try/catch block, the interactive session tries to include the file
again. This never stops and in continually includes the file over and
over. If you change the function to print out $i, you will see this
clearly.

If the condition is "true", it exhibits the correct behavior. False, or
a condition that evaluates to false, introduces the bug.


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

[2008-08-07 23:52:52] mazzarelli at gmail dot com

Description:
------------
when running a bit of code from the command line, it works. Running the
same code interactively causes it to hang.

Reproduce code:
---------------
<?php
// example1.php
if (false) {
  try {} catch (Exception $e) {}
}
?>

<?php
// example2.php
function stop_the_madness () {
  static $i;
  if (++$i > 1) exit("WTF?!\n");
}

stop_the_madness();

if (false) {
  try {} catch (Exception $e) {}
}

exit("A-OK\n");
?>

Expected result:
----------------
In the first snippet, nothing should happen. But when that is in a
file, and require_once'ed from the interactive shell, it hangs.

In the second example, when ran from CLI, it says A-OK. But when ran
interactively, it says "WTF?!"



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


-- 
Edit this bug report at http://bugs.php.net/?id=45749&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.