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

Skip to content

[YAML] Parse error with comments before scalar value inside collection #25620

Closed
@enekochan

Description

@enekochan
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.3.14

Given:

        $yaml = <<<YAML
array:
    - option:
        # A comment
        value: 'a value'
YAML;
        dump(\Symfony\Component\Yaml\Yaml::parse($yaml));

I get:

  [Symfony\Component\Yaml\Exception\ParseException]
  Unable to parse at line 4 (near "    value: 'a value'").

I got this error just after upgrading from Symfony 3.3.13 to 3.3.14 inside my httplug config section. I followed instructions in its documentation example in http://docs.php-http.org/en/latest/integrations/symfony-bundle.html#plugins and added a comment just between - add_host: and host: (the docs have some lines with 8 spaces as indentation, I've used both 8 and 4 just in case but made no difference). If I remove the comment it works fine for both versions 3.3.13 and 3.3.14.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions