|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-05-23 10:30 UTC] scottmac@php.net
[2007-05-23 10:42 UTC] aleboo at gmail dot com
[2007-05-23 11:29 UTC] scottmac@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 17:00:01 2025 UTC |
Description: ------------ Problem appears in try-catch block in some environment. When some code throws exception and there is no more any code right after throwing code in try-catchh block, then exception is not catched and it falls to system. Other, upper level try-catch blocks can't catch it too. Not sure about PHP version - it works on Windows with 5.2.0, it was working on Linux with 5.1.x version, but now it not working. Introducing die(), or break in the end of internal part of try-catch blocks sloves the problem, and exception is handled correcty, but it is offcourse workaround. Reproduce code: --------------- class Test{ public function doTest(){ try{ throw new Exception( "test exception" ); // with break or die() here code will work! }catch( Exception $ex ){ return "exception catched"; } return "ok"; } } $testObj = new Test(); $content = $testObj->doTest(); echo( $content ); Expected result: ---------------- "exception catched" text Actual result: -------------- Fatal error: Uncaught exception 'Exception' with message 'test exception' in /path-to-test-file-dir/test.php:5 Stack trace: #0 /path-to-test-file-dir/test.php(14): Test->doTest() #1 {main} thrown in /path-to-test-file-dir/test.php on line 5