Closed
Description
Symfony version(s) affected: 3.4.27
I reproduce symfony/yaml@e464640
Description
Comments after blank lines are read as value in yaml.
How to reproduce
$yaml = <<<YAML
parameters:
abc
# Comment
YAML;
var_dump(Symfony\Component\Yaml\Yaml::parse($yaml));
Actual result:
array(1) {
["parameters"]=>
string(13) "abc
# Comment"
}
Expected result:
array(1) {
["parameters"]=>
string(3) "abc"
}
Possible Solution
Ignore comment line.
Additional context
When I tested some Online YAML parser, I got the expected results.
https://yaml-online-parser.appspot.com/?yaml=parameters%3A%0A++++abc%0A%0A%23+Comment%0A&type=json
http://nodeca.github.io/js-yaml/#yaml=cGFyYW1ldGVyczoKICAgIGFiYwoKIyBDb21tZW50IAo=