|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2020-06-28 12:39 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 04:00:01 2025 UTC | 
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.