Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Yaml] parses misplaced keys in strings #27874

Closed
@xabbuh

Description

@xabbuh

Symfony version(s) affected: 3.x/4.x

Description

When you use a mapping key in a multi-line string, that value is mistakenly treated as part of the string while it should lead to a parser error instead.

How to reproduce

use Symfony\Component\Yaml\Yaml;

$yaml = <<<EOT
doctrine:
    dbal:yeah
        default_connection: monolith
EOT;

print_r(Yaml::parse($yaml));

ends up in this result:

Array
(
    [doctrine] => dbal:yeah default_connection: monolith
)

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