Skip to content

[Yaml] Anchors are not parsed correctly when inlined #40823

@alcaeus

Description

@alcaeus

Symfony version(s) affected: Tested on 5.x

Description

Anchors are parsed correctly when not used inline, but ignored when they are. The test below highlights the problem.

How to reproduce

    public function testInlineReferences()
    {
        $this->assertEquals([
            'foo' => ['bar' => 'baz'],
            'bar' => ['foo' => 'baz']
        ], Yaml::parse(<<<'EOF'
foo: { bar: &baz baz }
bar: { foo: *baz }
EOF
        ));
    }

Possible Solution
References are passed by value to the Inline parser, which may be a BC break if changed. There is no handling whatsoever for anchors, which requires significant changes to the inline parser that I don't feel comfortable doing (for lack of experience with it).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy