We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following code:
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
Error
constant
8.0.0
PHP 8.1.12
No response
The text was updated successfully, but these errors were encountered:
Fascinating! That bug existed for years, and now it has been reported twice within a few days. Anyhow, already solved now (see #9905).
Sorry, something went wrong.
@cmb69 hah great, I triggered it just today by doing something with an enum :)
Possibly https://wiki.php.net/rfc/dynamic_class_constant_fetch has sparked interest in this current way of doing it?
Check that RuleType enum value is valid before trying to instantiate it
d591dc6
This was triggering a fatal error, see php/php-src#9930
No branches or pull requests
Description
The following code:
Resulted in this output:
But I expected this output instead:
i.e. the error should be caught as a throwable
Error
, as is the behaviour ofconstant
since8.0.0
PHP Version
PHP 8.1.12
Operating System
No response
The text was updated successfully, but these errors were encountered: