#28290 [Com]: Throwing exception in eval'led code is not handled correctly

From: Date: Tue, 11 May 2004 03:10:36 +0000
Subject: #28290 [Com]: Throwing exception in eval'led code is not handled correctly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-59488@lists.php.net to get a copy of this message
ID: 28290 Comment by: vkatragadda at email dot com Reported By: arnoud at rattink dot com Status: Open Bug Type: Zend Engine 2 problem Operating System: SuSE Linux 8.2 PHP Version: 5.0.0RC2 New Comment: hello, i dont think this is a bug. i believe the line after eval gets executed by default. i think everything in the try{} block is supposed to get executed, and then the catch{} block is called... Previous Comments: ------------------------------------------------------------------------ [2004-05-05 23:47:01] arnoud at rattink dot com Description: ------------ The code below prints GRRRRRRRR. This is incorrect as the throwing of the exception is supposed to bring us immediately to the catchblock. It is also inconsistent, since I can replace the eval with just $f = AAAAAARRRRRRRRG(); and then it skips the echo. Reproduce code: --------------- <? function AAAAAARRRRRRG(){ throw new Exception("AAAAAARRRRRRG"); } try { eval('$f = AAAAAARRRRRRG();'); echo "GRRRRRRRR\n"; } catch(Exception $e) { echo "Exception caught nice and clean\n"; } ?> Expected result: ---------------- I do not expect to see GRRRRRRRR. Actual result: -------------- GRRRRRRRR Exception caught nice and clean ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28290&edit=1

« previous php.bugs (#59488) next »