8000 [YAML] Merge (<<) wrong priority · Issue #11154 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[YAML] Merge (<<) wrong priority #11154

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
Tobion opened this issue Jun 18, 2014 · 2 comments
Closed

[YAML] Merge (<<) wrong priority #11154

Tobion opened this issue Jun 18, 2014 · 2 comments

Comments

@Tobion
Copy link
Contributor
Tobion commented Jun 18, 2014

According to http://yaml.org/type/merge.html

Keys in mapping nodes earlier in the sequence override keys specified in later mapping nodes.

but the YAML component uses the wrong way. Later mapping nodes override previous ones currently.

A test is even testing the wrong thing: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Yaml/Tests/Fixtures/sfMergeKey.yml It should be 'head' => array('a' => 'Steve' ...

The problematic code is https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Yaml/Parser.php#L155
Simply switching the array_merge arguments would solve the problem, but also change the ordering of the array...

@stof
Copy link
Member
stof commented Jun 18, 2014

isn't it the same as #11142 ?

@Tobion
Copy link
Contributor Author
Tobion commented Jun 18, 2014

No, this issue is about

foo:
        <<: [ *foo1 , *foo2 , *foo3 ]

and #11142 is about

changed-value-after-merge:
    << : *foo1
    foo: overwrite

Tobion added a commit to Tobion/symfony that referenced this issue Jun 18, 2014
Tobion added a commit to Tobion/symfony that referenced this issue Jun 18, 2014
Tobion added a commit to Tobion/symfony that referenced this issue Jun 19, 2014
fabpot added a commit that referenced this issue Jun 20, 2014
This PR was merged into the 2.5 branch.

Discussion
----------

[YAML] fix merge node (<<)

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | yes but according to spec
| Deprecations? | no
| Tests pass?   | yes
| Needs merge to | 2.5
| Fixed tickets | #11142 and #11154
| License       | MIT
| Doc PR        | —

First commit small refactoring.
Second fixes #11154 (causing a BC break for a less common feature)
Third fixes #11142

Commits
-------

dee1562 [Yaml] fix overwriting of keys after merged map
8c621ab [Yaml] fix priority of sequence merges according to spec
02614e0 [Yaml] refactoring of merges for performance
@Tobion Tobion closed this as completed Jun 20, 2014
Nemrtvej added a commit to EdgedesignCZ/TexyBundle that referenced this issue Sep 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0