Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Unexpected characters using YAML compact syntax #37788

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

Closed
miceno opened this issue Aug 9, 2020 · 2 comments · Fixed by #33763
Closed

Unexpected characters using YAML compact syntax #37788

miceno opened this issue Aug 9, 2020 · 2 comments · Fixed by #33763

Comments

@miceno
Copy link

miceno commented Aug 9, 2020

Symfony version(s) affected: 5.1.3

Description
I am reading the following YAML file, but I get a parser exception.

How to reproduce

This is the code:

        $config = Yaml::parseFile($ps_filepath, Yaml::PARSE_CONSTANT);

I am reading the following YAML file:

macro_scalar : /usr/local/fish
macro_list : [flounder, lobster, haddock]
macro_assoc : { 
  fish : [flounder, cod, haddock],
  shellfish : [scallop, crab, clam],
  other : [chicken, pig, cow]
}

override_value: "global"

This is the error:

Unexpected characters near "

override_value: "global"" at line 10.

If I move line override_value: "global" to the begining of the file, the problem dissapears:

override_value: "global"
macro_scalar : /usr/local/fish
macro_list : [flounder, lobster, haddock]
macro_assoc : { 
  fish : [flounder, cod, haddock],
  shellfish : [scallop, crab, clam],
  other : [chicken, pig, cow]
}
@miceno miceno added the Bug label Aug 9, 2020
@miceno miceno changed the title Unexpected characters using compact YAML syntax Unexpected characters using YAML compact syntax Aug 9, 2020
@xabbuh xabbuh added the Yaml label Aug 10, 2020
@RevZer0
Copy link

RevZer0 commented Aug 13, 2020

There is no breakpoint from this loop https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Yaml/Parser.php#L1230
So it collects all lines till the end of file after '{' sequence block start.
I can make PR on this if needed

@miceno
Copy link
Author

miceno commented Aug 18, 2020

Yes please 👍

RevZer0 added a commit to RevZer0/symfony that referenced this issue Aug 18, 2020
@xabbuh xabbuh linked a pull request Nov 15, 2020 that will close this issue
fabpot added a commit that referenced this issue Nov 19, 2020
This PR was merged into the 4.4 branch.

Discussion
----------

[Yaml] fix lexing nested sequences/mappings

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | #34805, #37788, #37876, #39011, #39013, #39064
| License       | MIT
| Doc PR        |

Commits
-------

4c15f80 fix lexing nested sequences/mappings
@fabpot fabpot closed this as completed Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants