Skip to content
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

[2.2][Yaml] Blank values should resolve to null #7274

Closed
igorw opened this issue Mar 5, 2013 · 4 comments
Closed

[2.2][Yaml] Blank values should resolve to null #7274

igorw opened this issue Mar 5, 2013 · 4 comments
Labels
Bug Good first issue Ideal for your first contribution! (some Symfony experience may be required) Yaml

Comments

@igorw
Copy link
Contributor

igorw commented Mar 5, 2013

The following syntax was valid in 2.1, and should be valid according to the YAML spec:

db.options:
  password:
myproject.test:
  param2: "456"

However, since 2.2 this throws a Symfony\Component\Yaml\Exception\ParseException: Indentation problem in "file.yml" at line 2 (near "password:").

IMO this should be fixed. Or if the BC break was intentional, it should be documented.

igorw added a commit to igorw/ConfigServiceProvider that referenced this issue Mar 5, 2013
@stof
Copy link
Member

stof commented Mar 5, 2013

@igorw blank values are not valid in Yaml 1.2

@igorw
Copy link
Contributor Author

igorw commented Mar 6, 2013

Please point me to where this is mentioned. Unless I'm misunderstanding the spec, it should be allowed.

7.2. Empty Nodes states that:

{
  ? foo :°,
  °: bar,
}

Should resolve to:

%YAML 1.2
---
!!map {
  ? !!str "foo" : !!null "",
  ? !!null ""   : !!str "bar",
}

Where ° is an empty value.

@stof
Copy link
Member

stof commented Mar 6, 2013

hmm, right.

Btw, the inline parser is inconsistent as it parses it as a string: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Yaml/Inline.php#L47

@pvolok
Copy link
Contributor

pvolok commented Apr 12, 2013

working on it

fabpot added a commit that referenced this issue Apr 12, 2013
This PR was merged into the 2.1 branch.

Discussion
----------

[2.2][Yaml] Fixed resolving blank values

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #7274
| License       | MIT
| Doc PR        | -

Also, Seldaek suggested to rename the $notEOF variable.

Commits
-------

fb686d8 [Yaml] improved boolean naming ($notEOF -> !$EOF)
047212a [Yaml] fixed handling an empty value
@fabpot fabpot closed this as completed Apr 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Good first issue Ideal for your first contribution! (some Symfony experience may be required) Yaml
Projects
None yet
Development

No branches or pull requests

4 participants