#41406 [Opn->Fbk]: try/catch and Exceptions causing an infinite loop
| From: | tony2001@php.net | Date: | Wed, 16 May 2007 12:39:28 +0000 |
| Subject: | #41406 [Opn->Fbk]: try/catch and Exceptions causing an infinite loop | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-112685@lists.php.net to get a copy of this message | ||
ID: 41406
Updated by: tony2001@php.net
Reported By: andrew at alliancesoftware dot com dot au
-Status: Open
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: Fedora Core release 4 (Stentz)
PHP Version: 5.2.2
New Comment:
Cannot reproduce:
first
Fatal error: Uncaught exception 'Exception' with message 'second' in
/tmp/3.php:8
Stack trace:
#0 {main}
thrown in /tmp/3.php on line 8
Previous Comments:
------------------------------------------------------------------------
[2007-05-16 07:23:13] andrew at alliancesoftware dot com dot au
Description:
------------
If i throw an exception in a try/catch block, and then try throwing the
same type of exception after the try/catch block has ended it will
infinitely loop through the catch block.
Reproduce code:
---------------
try {
throw new Exception('first');
} catch (Exception $e) {
print $e->getMessage()."\n";
}
throw new Exception('second');
Expected result:
----------------
Should just print 'first' and then exit with an uncaught Exception.
Actual result:
--------------
It prints 'first' as expected, but then goes on to infinitely loop
through the catch block again printing 'second' from the latter
exception (that is outside the catch block)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41406&edit=1