Bug->Req #79753 [Opn]: Fatal error can not be caught - not with catch nor error handler
| From: | cmb@php.net | Date: | Tue, 30 Jun 2020 14:57:29 +0000 |
| Subject: | Bug->Req #79753 [Opn]: 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-227747@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: cmb@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
-Type: Bug
+Type: Feature/Change Request
Package: Scripting Engine problem
Operating System: any
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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