Skip to content

Two equivalent syntax of yaml-Collections produce different output for the same values #44019

Open
@gorenstein

Description

@gorenstein

Symfony version(s) affected

Tested and reproduced on 4.4 and 5.3

Description

In case the first character of the string is ampersand &, then two equivalent syntax of YAML-Collections produce different output for the same values.

How to reproduce

Add YAML parameters like:

parameters:
    # Correct values in console output  -> ["&string1","&string2","&string3"]
    collection_output_correct:
        - '&string1'
        - "&string2"
        - !!str &string3

    # Wrong values in console output -> ["","","",""]
    collection_output_wrong: ['&string1', "&string2", !!str &string3, &string4 ]

Run bin/console debug:container --parameters and compare output for 'collection_output_correct' and 'collection_output_wrong' parameters.

Possible Solution

No response

Additional Context

No response

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