[php-src] Issue #9930: Constant causes an uncatchable fatal error when given non-existent class

From: Date: Fri, 11 Nov 2022 11:41:51 +0000
Subject: [php-src] Issue #9930: Constant causes an uncatchable fatal error when given non-existent class
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242793@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9930 Author: ciaranmcnulty ### Description The following code: ```php var_dump(defined('Foo::foo')); try { $class = constant('Foo::foo'); } catch (\Throwable $e) { echo "I caught it!"; } ``` Resulted in this output: ``` bool(false) Fatal error: Class "Foo" not found in /in/7tWT2 on line 6 Process exited with code 255. ``` But I expected this output instead: ``` bool(false) I caught it! ``` i.e. the error should be caught as a throwable Error, as is the behaviour of constant since 8.0.0 ### PHP Version PHP 8.1.12 ### Operating System _No response_

« previous php.bugs (#242793) next »