ID: 45749 Updated by: [EMAIL PROTECTED] Reported By: mazzarelli at gmail dot com -Status: Open +Status: Verified Bug Type: Scripting Engine problem Operating System: Ubuntu 8.04 PHP Version: 5.2.6 New Comment:
Reproducing: $ php -a Interactive shell php > include "example2.php"; WTF?! Previous Comments: ------------------------------------------------------------------------ [2008-08-08 01:39:03] mazzarelli at gmail dot com 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. ------------------------------------------------------------------------ [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