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

[Yaml] fixed parse shortcut Key after unindented collection. #13352

Merged
merged 1 commit into from Jan 25, 2015

Conversation

aitboudad
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Fixed tickets #13345, #8093, #11019 and #10885
Tests pass? yes
License MIT

@@ -336,7 +336,8 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
$removeComments = !preg_match($removeCommentsPattern, $this->currentLine);
}

if ($isItUnindentedCollection && !$this->isStringUnIndentedCollectionItem($this->currentLine)) {
$isStringUnIndentedShortcutKey = (2 === ($indent - $newIndent));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would happen if the YAML string actually were?

collection:
-  key: foo
   foo: bar

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Unable to parse at line 3 (near " foo: bar")
I think it's another case not supported yet, even:

collection:
    -  key: foo
       foo: bar

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xabbuh event it not related to this PR, here is another issue:

collection:
    -  key: foo

Excepted:

{
  "collection": [
    {
      "key": "foo"
    }
  ]
}

But given:

{
  "collection": [
    {
        "key: foo"
    }
  ]
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aitboudad Honestly, I don't see a (semantical) difference between your two examples.

Could we remeber the number of spaces between the dash and the list item when detecting such constructs to not use a hard-coded value of 2 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aitboudad aitboudad force-pushed the ticket_13345 branch 3 times, most recently from 3a1c8c1 to 664cf91 Compare January 10, 2015 22:04
@stof
Copy link
Member

stof commented Jan 18, 2015

@fabpot please ignore the Yaml test fixtures in fabbot (or refactor the Yaml testsuite to avoid using multiple documents in the same files)

@stof
Copy link
Member

stof commented Jan 18, 2015

👍

@fabpot
Copy link
Member

fabpot commented Jan 25, 2015

Thanks for fixing this bug @aitboudad.

@fabpot fabpot merged commit 58a7426 into symfony:2.3 Jan 25, 2015
fabpot added a commit that referenced this pull request Jan 25, 2015
…n. (aitboudad)

This PR was merged into the 2.3 branch.

Discussion
----------

[Yaml] fixed parse shortcut Key after unindented collection.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Fixed tickets  | #13345, #8093, #11019 and #10885
| Tests pass?   | yes
| License       | MIT

Commits
-------

58a7426 [Yaml] fixed parse shortcut Key after unindented collection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants