[Yaml] Allow parsing of unindented closing quotation mark#33119
[Yaml] Allow parsing of unindented closing quotation mark#33119johnillo wants to merge 2 commits intosymfony:4.3from johnillo:fix/yaml-unindented-close-quote
Conversation
|
@johnillo thanks for contributing this fix! I have a question about the number of |
|
If I do not miss anything, the following YAML string would still not be parsed: foo:
bar: 'baz
foobar'This is due to the fact that the parser does not properly handle the inline notation when split across multiple lines. From my point of view I would rather invest some time to try to add support for the multi-line notation spanning multiple lines entirely instead of solving it only partially. |
|
About the missing |
|
I don't think this is valid Yaml, the spec explicitly refers to the indentation of each line when defining quoted scalars ( https://yaml.org/spec/1.1/current.html#l-single-inner(n) ):
And |
|
@fabpot I think I have to agree with you that it's not worth it. I've tried different parsers online and they behave differently on this kind of input. I'll close this PR. Thanks everyone. |
…axbeckers) This PR was submitted for the 5.4 branch but it was merged into the 7.1 branch instead. Discussion ---------- [Yaml] Fix Yaml Parser with quote end in a new line | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #33082 | License | MIT | Doc PR | N/A This is a fix for issue #33082. The bug described in the ticket breaks on a ending quote in a new line: ``` foo: bar: 'baz ' baz: 'Lorem' ``` Before the fix: `Symfony\Component\Yaml\Exception\ParseException: Malformed inline YAML string: 'baz at line 4.` There was already a PR #33119, which was closed because of problems. Commits ------- 21cec3f [Yaml] Fix Yaml Parser with quote end in a new line


Unindented quotation marks are not parsed correctly by the parser. Online parsers accepts values/strings with unindented quotation marks as valid yaml.
Before fix
After fix