8000 [Yaml] parses misplaced keys in strings · Issue #27874 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Yaml] parses misplaced keys in strings #27874

New issue
8000

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
xabbuh opened this issue Jul 6, 2018 · 0 comments · Fixed by #27898
Closed

[Yaml] parses misplaced keys in strings #27874

xabbuh opened this issue Jul 6, 2018 · 0 comments · Fixed by #27898

Comments

@xabbuh
Copy link
Member
xabbuh commented Jul 6, 2018

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
)
xabbuh added a commit that referenced this issue Feb 6, 2019
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Yaml] Fixed invalid Parser behavior

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

This fixes #27874
I'm not sure about the update in composer.json though. It seems a good idea because I was able to run composer update without the zip extension. If required, I'll remove it.

Commits
-------

7bf8381 Added deprecation notice when mapping keys are found in multi-line blocks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0