Skip to content

[YAML] Defining a reference on a merge key does not work. #23587

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
magnusnordlander opened this issue Jul 19, 2017 · 2 comments
Closed

[YAML] Defining a reference on a merge key does not work. #23587

magnusnordlander opened this issue Jul 19, 2017 · 2 comments

Comments

@magnusnordlander
Copy link
Contributor

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

In other YAML implementations, it is possible to define a reference on a merge key, e.g. as follows:

root:
    mergekeyrefdef:
        a: foo
        <<: &quux
            b: bar
            c: baz
    mergekeyderef:
        d: quux
        <<: *quux

This should be parsed as the following data structure:

    array(
        'mergekeyrefdef' => array('a' => 'foo', 'b' => 'bar', 'c' => 'baz'),
        'mergekeyderef' => array('d' => 'quux', 'b' => 'bar', 'c' => 'baz')
    )

However, in all Symfony versions, this emits the following error:

Symfony\Component\Yaml\Exception\ParseException: YAML merge keys used with a scalar value instead of an array at line 4 (near "<<: &quux").
@xabbuh
Copy link
Member

xabbuh commented Sep 13, 2017

see #24189 (it does not fix this issue)

@xabbuh xabbuh added this to the 2.7 milestone Sep 28, 2017
@xabbuh
Copy link
Member

xabbuh commented Oct 3, 2017

see #24417

fabpot added a commit that referenced this issue Oct 5, 2017
This PR was merged into the 2.7 branch.

Discussion
----------

[Yaml] parse references on merge keys

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

Commits
-------

dab72ab [Yaml] parse references on merge keys
@fabpot fabpot closed this as completed Oct 5, 2017
fabpot added a commit that referenced this issue Oct 6, 2017
This PR was merged into the 3.3 branch.

Discussion
----------

[Yaml] parse references on merge keys with objects

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

Applies necessary changes on the `3.3` branch to make #24417 work with the `PARSE_OBJECT_FOR_MAP` flag.

Commits
-------

ce10f35 parse references on merge keys with objects
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

5 participants