Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[YAML] Usage of PHP constant in YAML keys fails on 3.3 #22854

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

Closed
tgalopin opened this issue May 22, 2017 · 5 comments
Closed

[YAML] Usage of PHP constant in YAML keys fails on 3.3 #22854

tgalopin opened this issue May 22, 2017 · 5 comments

Comments

@tgalopin
Copy link
Contributor

tgalopin commented May 22, 2017

Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no
Symfony version 3.3

The following file was valid on 3.2 and its parsing fail on 3.3:
https://github.com/EnMarche/en-marche.fr/blob/fce5e06a50fa87b3416e6bb9dee13f1bafe000f4/app/config/services/workflows.yml#L14
https://circleci.com/gh/EnMarche/en-marche.fr/4428

It seems to be related to the usage of PHP constants as keys:

transitions:
    !php/const:AppBundle\TonMacron\InvitationProcessor::TRANSITION_FILL_INFO:
        from:
            - !php/const:AppBundle\TonMacron\InvitationProcessor::STATE_NEEDS_FRIEND_INFO
        to: !php/const:AppBundle\TonMacron\InvitationProcessor::STATE_NEEDS_FRIEND_PROJECT

Is it an invalid YAML syntax? Should I update it or is it a BC break in 3.3?

@GuilhemN
Copy link
Contributor

GuilhemN commented May 23, 2017

I don't think the parser is able to parse this tag as a key, that's why we should remove the : from its syntax btw to use a more regular syntax (!php/const "MyClass::CONST").
Are you sure it worked as expected using 3.2?

@chalasr
Copy link
Member

chalasr commented May 23, 2017

I confirm it worked and it doesn't anymore

@xabbuh
Copy link
Member

xabbuh commented May 23, 2017

Can you please try #22878?

@tgalopin
Copy link
Contributor Author

@xabbuh working on it

@tgalopin
Copy link
Contributor Author

@xabbuh I have an error:

Uncaught TypeError: Argument 1 passed to Symfony\Component\Debug\ErrorHandler::handleException() must be an instance of Exception, instance of Error given

on bin/console list -vvv

It may be related to the notice of @chalasr on your PR. I can't debug easily right now, let's wait tomorrow :) .

@nicolas-grekas nicolas-grekas modified the milestone: 3.3 May 25, 2017
nicolas-grekas added a commit that referenced this issue May 25, 2017
This PR was merged into the 3.3 branch.

Discussion
----------

[Yaml] parse PHP constants in mapping keys

| Q             | A
| ------------- | ---
| Branch?       | 3.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #22854
| License       | MIT
| Doc PR        |

Commits
-------

ae52fe6 [Yaml] parse PHP constants in mapping keys
@xabbuh xabbuh closed this as completed May 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants