Allow arbitrary const expressions in backed enums#8190
Closed
iluuu1994 wants to merge 1 commit intophp:masterfrom
Closed
Allow arbitrary const expressions in backed enums#8190iluuu1994 wants to merge 1 commit intophp:masterfrom
iluuu1994 wants to merge 1 commit intophp:masterfrom
Conversation
staabm
reviewed
Mar 11, 2022
Member
|
Assigning a static property a constant expr of the wrong type gets you a TypeError (thus should be identical here). Everything else probably should just throw an Error. In case |
8d3812a to
f77bef3
Compare
nikic
reviewed
May 28, 2022
arnaud-lb
reviewed
May 29, 2022
iluuu1994
commented
Jun 9, 2022
arnaud-lb
approved these changes
Jun 10, 2022
Closes phpGH-7821 Closes phpGH-8190 Closes phpGH-8418
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes GH-7821
Open issues:
ZSTR_HAS_CE_CACHE(class_name)returnstruefor"self"even thoughzend_alloc_ce_cachespecifically guards for that. Sounds like memory corruption but I couldn't figure out where yetWe probably need more forgiving error handling thanAll other errors inzend_error_noreturnnow that the errors are moved to runtime.zend_do_link_classseem to be fatal so I think this is consistent.enum_backing_tableto store the case directly but that might not actually work for internal enums (or we changezend_enum_add_casenot to modify the backing table anymore and move that to after the constants have been initialized)Can we add theThat would require tracking dependencies of all classes in all expressions so likely not feasible.backed_enum_tableto the inheritance cache to avoid re-population on every request?