#41406 [Opn->Bgs]: try/catch and Exceptions causing an infinite loop

From: Date: Mon, 21 May 2007 08:55:17 +0000
Subject: #41406 [Opn->Bgs]: try/catch and Exceptions causing an infinite loop
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112891@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: Bogus Bug Type: Scripting Engine problem Operating System: Fedora Core release 4 (Stentz) PHP Version: 5.2.2 New Comment: Please update Zend Optimizer to the latest available version and if you're still able to reproduce it, report it to support@zend.com. Not PHP problem. Previous Comments: ------------------------------------------------------------------------ [2007-05-21 02:15:13] andrew at alliancesoftware dot com dot au On further investigation, bug only happens if the zend optimizer is also loaded: zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-3.0.1 (not sure if the bug should be reported here or not, but leaving a comment for anyone else who experiences it) ------------------------------------------------------------------------ [2007-05-16 12:39:23] tony2001@php.net 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 ------------------------------------------------------------------------ [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

« previous php.bugs (#112891) next »