Skip to content

[Yaml] deprecate parsing mappings without keys #21643

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

Merged
merged 1 commit into from
Feb 17, 2017

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Feb 17, 2017

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? yes
Tests pass? yes
Fixed tickets
License MIT
Doc PR

public function testTheEmptyStringIsAValidMappingKey()
{
$this->assertSame(array('' => 'foo'), Inline::parse('{ "": foo }'));
}
Copy link
Member Author

Choose a reason for hiding this comment

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

The two tests above were already passing without this patch. I just added them to prevent future regressions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if we shouldn't just add these two tests in 2.7 now.

Copy link
Member

Choose a reason for hiding this comment

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

👍 for adding them in an older version, to prevent regressions on them when doing bugfixes in older branches

Copy link
Member Author

Choose a reason for hiding this comment

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

see #21650

@stof
Copy link
Member

stof commented Feb 17, 2017

what is the existing behavior for a mapping without key ?

@stof
Copy link
Member

stof commented Feb 17, 2017

if the parser is not broken currently for such case, and so accepts the input (even though it is not compliant), we should rather deprecate it instead, to be consistent with our previous changes where we give users time to update their YAML files

@xabbuh
Copy link
Member Author

xabbuh commented Feb 17, 2017

The parser behaviour currently is inconsistent since some changes we made in 3.2. However, you are right that we should deprecate it first on master (#21647 will make sure that the wrong behaviour is restored in the 3.2 branch).

Status: Needs work

@xabbuh xabbuh force-pushed the scalar-mapping-keys branch from 47e720a to e0ea989 Compare February 17, 2017 11:35
@xabbuh xabbuh changed the base branch from 2.7 to master February 17, 2017 11:35
@xabbuh xabbuh changed the title [Yaml] fail when parsing mappings without keys [Yaml] deprecate parsing mappings without keys Feb 17, 2017
@xabbuh xabbuh force-pushed the scalar-mapping-keys branch 2 times, most recently from 5022517 to f2ab286 Compare February 17, 2017 11:47
@xabbuh
Copy link
Member Author

xabbuh commented Feb 17, 2017

I updated here to deprecate the possibility to omit mapping keys and changed the target branch to master. Please not that this contains the changes from #21647 and needs to be merged afterwards.

Status: Needs Review

@stof
Copy link
Member

stof commented Feb 17, 2017

the other PR is now merged (including in master)

@xabbuh
Copy link
Member Author

xabbuh commented Feb 17, 2017

rebased

@stof
Copy link
Member

stof commented Feb 17, 2017

👍

UPGRADE-3.3.md Outdated
@@ -119,6 +119,8 @@ Workflow
Yaml
----

* Omitting the key of a mapping is deprecated and will lead to a `ParseException` in Symfony 4.0.
Copy link
Member

Choose a reason for hiding this comment

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

and throws a?

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

@xabbuh xabbuh force-pushed the scalar-mapping-keys branch from 135a5cb to c02dca3 Compare February 17, 2017 15:52
@fabpot
Copy link
Member

fabpot commented Feb 17, 2017

Thank you @xabbuh.

@fabpot fabpot merged commit c02dca3 into symfony:master Feb 17, 2017
fabpot added a commit that referenced this pull request Feb 17, 2017
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Yaml] deprecate parsing mappings without keys

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

Commits
-------

c02dca3 [Yaml] deprecate parsing mappings without keys
@xabbuh xabbuh deleted the scalar-mapping-keys branch February 17, 2017 16:32
fabpot added a commit that referenced this pull request Mar 1, 2017
This PR was merged into the 2.7 branch.

Discussion
----------

[Yaml] add tests for specific mapping keys

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | see #21643 (comment)
| License       | MIT
| Doc PR        |

Commits
-------

b8e0d70 [Yaml] add tests for specific mapping keys
symfony-splitter pushed a commit to symfony/yaml that referenced this pull request Mar 1, 2017
This PR was merged into the 2.7 branch.

Discussion
----------

[Yaml] add tests for specific mapping keys

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | see symfony/symfony#21643 (comment)
| License       | MIT
| Doc PR        |

Commits
-------

b8e0d705f6 [Yaml] add tests for specific mapping keys
@fabpot fabpot mentioned this pull request May 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants