You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
This PR was merged into the 4.4 branch.
Discussion
----------
[Yaml] Allow tabs as separators between tokens
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#40507
| License | MIT
| Doc PR | None
As described in #40507, the Yaml spec allows tabs as whitespace characters between tokens. However, the Yaml parser crashes on this as it only expects spaces after the colon. https://yaml.org/spec/1.2/spec.html#id2778241
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.
Commits
-------
9a130ae Fix issue 40507: Tabs as separators between tokens
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected: 4.4.19
Description
symfony/yaml
throws aSymfony\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(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:
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.
The text was updated successfully, but these errors were encountered: