Req #79753 [Com]: Fatal error can not be caught - not with catch nor error handler

From: Date: Sun, 05 Jul 2020 10:38:12 +0000
Subject: Req #79753 [Com]: Fatal error can not be caught - not with catch nor error handler
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227829@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79753&edit=1 ID: 79753 Comment by: michael dot vorisek at email dot cz Reported by: michael dot vorisek at email dot cz Summary: Fatal error can not be caught - not with catch nor error handler Status: Open Type: Feature/Change Request Package: Scripting Engine problem Operating System: any PHP Version: Irrelevant Block user comment: N Private report: N New Comment: shutdown function is called when registered: https://3v4l.org/FMoCK so parse error should be possible to fix as the VM state is not corrupted Previous Comments: ------------------------------------------------------------------------ [2020-06-30 14:57:29] cmb@php.net Well, that is not a bug; changing to feature request. Note, though, that recovery isn't possible for all error cases. In this case, it might be possible, but that's not trivial. ------------------------------------------------------------------------ [2020-06-28 12:39:26] michael dot vorisek at email dot cz Description: ------------ see test code, there should be a possibility to catch these/all errors Test script: --------------- <?php class A { public function x(): void {} } set_error_handler(function() { echo 'handled'; }); try { if (time() > 0) { // wrap in if to make sure an error is not throw at compile time class B extends A { public function x() {} } } } catch (\Throwable $e) { echo 'catched'; } Expected result: ---------------- "handled" or "catched" Actual result: -------------- fatal error message, no possibility to catch the error ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79753&edit=1

« previous php.bugs (#227829) next »