Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Yaml] fix PHP const mapping keys using the inline notation#35318
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
xabbuh commentedJan 13, 2020
| Q | A |
|---|---|
| Branch? | 3.4 |
| Bug fix? | yes |
| New feature? | no |
| Deprecations? | no |
| Tickets | Fix#35179 |
| License | MIT |
| Doc PR |
fabpot commentedJan 13, 2020
Thank you@xabbuh. |
…n (xabbuh)This PR was merged into the 3.4 branch.Discussion----------[Yaml] fix PHP const mapping keys using the inline notation| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |Fix#35179| License | MIT| Doc PR |Commits-------45461c7 fix PHP const mapping keys using the inline notation
rhift commentedJan 20, 2020
hey@xabbuh will this make its way into the YAML component? Sorry, I'm not familiar with the release process. Thanks for fixing it! |
xabbuh commentedJan 20, 2020
@rhift Yes, this change will be part of the next patch releases for 3.4, 4.3, 4.4 and 5.0 as well as future minor versions. |
| $isKeyQuoted =\in_array($mapping[$i], ['"',"'"],true); | ||
| $key =self::parseScalar($mapping,$flags, [':',''],$i,false, [],true); | ||
| if ('!php/const' ===$key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Shouldn't we check forself::$constantSupport first? /cc@xabbuh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think this is fine becauseevaluateScalar() (which is called now) does the check.
rhift commentedApr 28, 2020
Hi there, thanks for this! I can get globally defined constants to work great, but I can't find a way to get class constants to work. Is this intended behavior? I've tried the following. !php/const \PATH\TO\Class::CONSTANT: "value"!php/const "\PATH\TO\Class::CONSTANT": "value" The scope resolution operator ( Being able to use class constants as keys was what I was hoping for when submitting#35179. Any help would be appreciated. Thank you. =) |
xabbuh commentedApr 29, 2020
@rhift If I don't miss anything, we have these cases covered with tests. Could you open a new issue please with some code that allows to reproduce so that we can see whether there is another bug or if there is something else going wrong? |