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

Skip to content

[Yaml] deprecated non-escaped \ in double-quoted strings when parsing #16201

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
Oct 12, 2015

Conversation

fabpot
Copy link
Member

@fabpot fabpot commented Oct 11, 2015

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

According to the YAML specs, backslashes must be escaped when used in a double-quoted string. So, "Foo\Var" is not valid, "Foo\\Var" is.

This PR deprecates the old ways so that we can throw an exception in 3.0 when parsing a non-compliant YAML string in 3.0.

ping @nicolas-grekas @tucksaun

@nicolas-grekas
Copy link
Member

👍

*/
public function unescapeCharacter($value)
{
switch ($value{1}) {
switch ($value[1]) {
Copy link
Member

Choose a reason for hiding this comment

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

not set when the unescaped backslash is the last character isn't it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, a backslash at the end is not possible as this caught before this is called. I've added a test for this case and tweaked the regex here accordingly.

@fabpot fabpot force-pushed the yaml-specs-deprecations branch from 6b176d7 to 08b7f0a Compare October 11, 2015 15:10
@tucksaun
Copy link
Contributor

👍

@fabpot fabpot force-pushed the yaml-specs-deprecations branch from 08b7f0a to e599a72 Compare October 12, 2015 10:20
@fabpot fabpot merged commit e599a72 into symfony:2.8 Oct 12, 2015
fabpot added a commit that referenced this pull request Oct 12, 2015
…gs when parsing (fabpot)

This PR was merged into the 2.8 branch.

Discussion
----------

[Yaml] deprecated non-escaped \ in double-quoted strings when parsing

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

According to the YAML specs, backslashes must be escaped when used in a double-quoted string. So, `"Foo\Var"` is not valid, `"Foo\\Var"` is.

This PR deprecates the old ways so that we can throw an exception in 3.0 when parsing a non-compliant YAML string in 3.0.

ping @nicolas-grekas @tucksaun

Commits
-------

e599a72 [Yaml] deprecated non-escaped \ in double-quoted strings when parsing
fabpot added a commit that referenced this pull request Oct 12, 2015
… (fabpot)

This PR was merged into the 3.0-dev branch.

Discussion
----------

[Yaml] removed YAML parser \ escaping in double-quotes

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

Should be rebased when #16201 is merged.

Commits
-------

5dbf6bc [Yaml] removed parsing of non-escaped backslash in a double-quoted string
@fabpot fabpot mentioned this pull request Nov 16, 2015
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