-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Yaml] parse omitted inlined mapping values as null #21118
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
|
Happy new year ! Best wishes :) About your change, why not replacing the |
f172cce to
47afa60
Compare
|
Happy new year for you too! :)
That's indeed much better. I updated the code accordingly. |
|
Having a |
47afa60 to
0cd3efb
Compare
0cd3efb to
9692f38
Compare
|
@GuilhemN @fabpot As far as I understand the specs the key cannot be omitted in a mapping and it will never be treated as a boolean value (correct me if I am wrong). The YAML parser at http://yaml-online-parser.appspot.com/ seem to confirm this. |
9692f38 to
8103249
Compare
|
@xabbuh I think that's exactly the problem mentioned by @GuilhemN You can add the following test, which is valid YAML (and works great): 'empty key is allowed' => array('{"": "foo"}', array("" => "foo")),But this one should fail (but it does not): 'null key is not allowed' => array('{: "foo"}', array(null => "foo")), |
8103249 to
10e1523
Compare
|
That's indeed an issue. I opened #21643 to fix this in older maintained versions too (this one should be merged into |
|
@xabbuh Can you rebase and add a note in the CHANGELOG? |
10e1523 to
c473504
Compare
|
done |
|
Thank you @xabbuh. |
…abbuh) This PR was merged into the 3.3-dev branch. Discussion ---------- [Yaml] parse omitted inlined mapping values as null | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #20841 (comment) | License | MIT | Doc PR | As @GuilhemN mentioned in #20841 (comment) when using the inline YAML notation, it is currently not possible to completely omit the mapping value to have it parsed as `null` (you have to pass `~` or `null` explicitly). Commits ------- c473504 parse omitted inlined mapping values as null
…agi) This PR was merged into the 3.3-dev branch. Discussion ---------- [Yaml] Fix legacy support for omitting mapping key | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | N/A | License | MIT | Doc PR | N/A Quick and dirty fix for the failing legacy `InlineTest::testOmittedMappingKeyIsParsedAsColon()` test (failing since #21118). Ping @xabbuh : I'm not used to the yaml component codebase and it's probably not the most pleasant one to read. 😄 So if you think there is a cleaner way to go, please just close this one in favor of yours. Commits ------- d246f2f [Yaml] Fix legacy support for omitting mapping key
As @GuilhemN mentioned in #20841 (comment) when using the inline YAML notation, it is currently not possible to completely omit the mapping value to have it parsed as
null(you have to pass~ornullexplicitly).