8000 symfony/yaml does not parse tabs after colon · Issue #40507 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
symfony/yaml does not parse tabs after colon #40507
Closed
@bertramakers

Description

@bertramakers

Symfony version(s) affected: 4.4.19

Description
symfony/yaml throws a Symfony\Component\Yaml\Exception\ParseException if it encounters a tab instead of space(s) after a colon, while tabs are valid as separation between tokens within a line according to the yaml spec: https://yaml.org/spec/1.2/spec.html#id2778241

Outside indentation and scalar content, YAML uses white space characters for separation between tokens within a line. Note that such white space may safely include tab characters.

(Emphasis mine)

How to reproduce
Use symfony/yaml to parse a yaml file with a tab after the colon of a key/value pair on a line.

For example:

'00D24000000JRFx:0012400000R6XYH':	95290dcc-8d1d-4b9f-952e-496562f53e35

Possible Solution
Allow tabs for separation between tokens within a line, as described in the yaml spec.
If I find some time I might look into a possible fix and make a PR myself unless someone else beats me to it.

Additional context
It has been mentioned in other issues like #15674 that tabs are not allowed in yaml files. But this is only the case for indentation.

While I'm not a huge fan of it personally, it's an issue when a different linter tells us that a given YAML file with content that we have little control over has valid syntax in an unrelated check, and then our app crashes because it cannot be parsed after all.

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

      0