-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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
Conversation
8823166
to
6b176d7
Compare
👍 |
*/ | ||
public function unescapeCharacter($value) | ||
{ | ||
switch ($value{1}) { | ||
switch ($value[1]) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
6b176d7
to
08b7f0a
Compare
👍 |
08b7f0a
to
e599a72
Compare
…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) 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
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