-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Yaml] fix for wrong parsing functionality on some indentation cases #8100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I have problems at the moments setting up PHPUnit testing environment, so any help with testing it would be appreciated.
@dekelev is your "will work" example valid? I can't parse it in my head, as you inject a sequence in the middle of a mapping. "won't work" example is another thing — sequence is a value, corresponding to key |
Because YAML depends on space indentation, "- b: c" line will always be a sibling to key "a", and not consider its mapped value. And regards to the empty value: #7274 So "a" key has a value, NULL value, because next line indentation is equal to this line which excludes it from mapping it as "a" value. |
Indentation is not the only mean for key/value distinction. see this http://www.yaml.org/spec/1.2/spec.html#id2772312 |
Right, but in these examples there is no other means of key/value distinction. only key/value mapping using colon+indentation OR colon+inline value |
"won't work" example is very similar to example from spec and unambiguously implies the following structure:
|
--- test: a: - b: c should implies {test: {a: null, [{b: c}]}} while --- test: a: - b: c should implies {test: {a: [{b: c}]}} |
@dekelev Tests are missing for your fix. and please update the description with the PR summary |
@dekelev |
FYI, both http://yamllint.com/ (using Ruby) and http://yaml-online-parser.appspot.com/ (using pyyaml in Python) are parsing it in the way described by @indeyets in the previous comment. |
thanks @indeyets, I'll try handle both cases in next commit. |
I dont get it,
and this should not even be valid:
it would indeed correspond to From what I understand, this PR tries to let the parser be more forgiving while the input should have been correct in the first place. |
@lavoiesl please read the spec and previous comments. It is a valid syntax |
just in case you guys are not aware #8562 👶 |
Closing this one as the Symfony YAML component has never been about implementing the whole YAML spec, but just the most-commonly used subset for configuration files. Doing any changes must come with a large number of unit tests to be sure than nothing breaks. This change does break things, so it cannot be merged anyway. Feel free to reopen with updated unit tests though. |
No description provided.