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

From: Date: Sun, 05 Jul 2020 10:46:20 +0000
Subject: Req #79753 [Opn->Sus]: 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-227830@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 Updated by: nikic@php.net Reported by: michael dot vorisek at email dot cz Summary: Fatal error can not be caught - not with catch nor error handler -Status: Open +Status: Suspended Type: Feature/Change Request Package: Scripting Engine problem Operating System: any PHP Version: Irrelevant Block user comment: N Private report: N New Comment: The state is corrupted, e.g. both "new B" and "class B {}" inside the shutdown function will fail. The executor is not unstable, but it also does not satisfy the necessary consistency requirements to make it throw. I'm suspending this to make it clear that we have no plans to convert this, or other inheritance errors, into exceptions in the near future. Previous Comments: ------------------------------------------------------------------------ [2020-07-05 10:38:12] michael dot vorisek at email dot cz 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 ------------------------------------------------------------------------ [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 (#227830) next »