Skip to content

[Yaml][DependencyInjection] references across files are broken #22698

@ivoba

Description

@ivoba
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.2.8

Since release 3.2.8 Yaml references across imports do not work anymore and fail with:

Reference "my.reference.from.file1" does not exist at line 1 (nea  
  r "test.in.file2: *my.reference.from.file1").

This probably was introduced with #22351 by @xabbuh

Test Scenario

file1.yml

vars:
    foo: &my.reference.from.file1
      baz: foobar

file2.yml

othervars:
  zigzag: *my.reference.from.file1

config.yml

imports:
  - { resource: "./file1.yml" }
  - { resource: "./file2.yml" }

I suppose the YamlFileLoader calls the Parser->parse() on every import and since the $this->refs array is resetted in parse() the references are missing on 2nd parse run.

Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php:396

Imports are not part of the YAML spec afaik, so the bug might rather be a part of the YamlFileLoader.

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