|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-08-22 20:49 UTC] cmb@php.net
-Status: Open
+Status: Not a bug
-Assigned To:
+Assigned To: cmb
[2020-08-22 20:49 UTC] cmb@php.net
[2020-08-23 15:34 UTC] brucekwells at gmail dot com
[2020-08-23 17:08 UTC] cmb@php.net
[2020-08-24 07:42 UTC] nikic@php.net
[2020-08-24 14:47 UTC] brucekwells at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 01:00:01 2025 UTC |
Description: ------------ Some Fatal Errors are caught in this script and some are not. Comment out the "extends TestBase" of the TestExtended class, and this example will catch the error: Return value of TestExtended::returnString() must be of the type int, string returned Or change the class in the new statement to an undefined class. Or change the method call. Both are fatal errors, both caught. But as written, this script does not catch the fatal error. Test script: --------------- <?php try { class TestBase { public function returnString() : string { return __METHOD__; } } class TestExtended extends TestBase { public function returnString() : int { return __METHOD__; } } $test = new TestExtended(); echo $test->returnString(); } catch (\Throwable $e) { echo 'Caught error: ' . $e->getMessage(); } phpinfo(); Expected result: ---------------- 'Caught error: ' followed by PHP error message is printed, followed by phpinfo() output. Actual result: -------------- Fatal error message is printed the standard PHP error handler and is not prefixed by 'Caught error: '. phpinfo() is also not printed.