-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Yaml] Deal with lines containing whitespace ONLY in multiline parser. #31369
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
One test added. and compared against libYAML operation. Sorry about the mess in commits. |
The list of commits in your branch seems to be a mess. |
@crayner can you please rebase+squash on branch 3.4? That should clean the git history. |
HI @nicolas-grekas , I tried to do the rebase-squash as suggested. Result may now be worse. Let me know. Happy to close request and rebuild form scratch given < 10 lines of code. |
@crayner It looks like you merged instead of rebasing (one great thing about rebasing is that it removes the merge commits, which prevent us from merging a pull request). You can find more information here: https://symfony.com/doc/current/contributing/code/pull_requests.html#rebase-your-pull-request If you want to, I will happily do it for you. |
Thanks @fabpot , I will have another go, as that is how one learns. |
Tried again, with a lot of errors at the but: tried PHPStorm script and it seemed to work? If it has not work as expected, please go ahead and rebase squash. |
what if this kind of structure does not appear as top-level ? |
Thanks @xabbuh |
@stof This will still fail in the existing parser code. A different fix?
|
…denormalizer of DateTimeNormalizer Code Style variations Deal with lines containing whitespace ONLY in multiline parser. Deal with leak of Normaliser Work Deal with leak of Normaliser Work Deal with leak of Normaliser Work Deal with leak of Normaliser Work Deal with leak of Normaliser Work Deal with leak of Normaliser Work Restore normal string operation of multiline when NOT embedded in {} or [] Deal with leak of Normaliser Work Deal with leak of Normaliser Work Deal with leak of Normaliser Work Deal with leak of Normaliser Work Deal with leak of Normaliser Work Deal with leak of Normaliser Work Remove empty Coding Standard Deal with lines containing whitespace ONLY in multiline parser. Deal with leak of Normaliser Work Deal with leak of Normaliser Work Deal with leak of Normaliser Work Deal with leak of Normaliser Work Deal with leak of Normaliser Work Deal with leak of Normaliser Work Restore normal string operation of multiline when NOT embedded in {} or [] Deal with leak of Normaliser Work Deal with leak of Normaliser Work Deal with leak of Normaliser Work Deal with leak of Normaliser Work Deal with leak of Normaliser Work Deal with leak of Normaliser Work Remove empty Coding Standard
In the past we decided not to support the JSON syntax in the YAML parser (see for example #18968). I would agree on a PR throwing a (more) meaningful exception when we detect such structures, but I am against supporting it only partially. |
@crayner can you do the PR ? |
Not sure I agree, therefore would like to see other opinions! What do you think @ylixir. This is not really a JSON fix, but a whitespace issue, IMHO. |
I think four things:
|
I have spent some time on parsing the inline notation when it spans mutliple lines (see #33658). That PR would land as a new feature in Symfony 4.4. I suggest to close here in favour of the new PR. |
This PR ignores lines in a YAML file that contain whitespace ONLY, effectively an empty line as far as the parser is concerned.
Speed:
Over 100 iterations compared to libYaml in PHP 7.3.4 on WAMP64 installation the average speed ratio is approx. 3.5:1 (SymfonyParser:libYaml) for data = "{\n \n}"