-
Notifications
You must be signed in to change notification settings - Fork 7.8k
The influence of opcache on the behavior of enum cases. #8418
New issue
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
Comments
We should probably set ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION while evaluating the enum value to avoid the discrepancy with and without opcache (by always making it an error). |
Hmmm.... Aren't class constants compile time instructions? It seems the other way around, it shouldn't throw any errors. |
Making this actually work requires #8190, i.e. support for evaluating the constant expression at runtime. It's not technically possible to evaluate a constant reference at compile-time if opcache is used (in the general case where the constant is defined in a different file). The only thing we can do in a patch release is to consistently forbid this. |
Closes phpGH-7821 Closes phpGH-8190 Closes phpGH-8418
Description
The following code:
Resulted in this output:
But I expected this output instead:
Conclusion
Environment
Linux (Debian-based)
Other Info
PHP Version
8.1.4
Operating System
Ubuntu Budgie 21.10
The text was updated successfully, but these errors were encountered: