Closed
Description
Description
The following code:
<?php
try {
\constant("\ExistantClass::non_existant_constant");
} catch (\Throwable|\Error|\Exception $e) {
echo($e->getMessage());
}
Resulted in this output:
⇒ php test.php
PHP Fatal error: Class "ExistantClass" not found in /Users/alexroche/Desktop/test.php on line 4
Fatal error: Class "ExistantClass" not found in /Users/alexroche/Desktop/test.php on line 4
But I expected this output instead:
"Error : Class "ExistantClass" not found"
(i.e. the error to be caught and the message to be echo'd - what that message is is purely semantics)
PHP Version
8.0.25, 8.1.12
Operating System
No response