Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 138654d

Browse filesBrowse files
committed
feature #16203 [Yaml] removed YAML parser \ escaping in double-quotes (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
2 parents 1d3a829 + 5dbf6bc commit 138654d
Copy full SHA for 138654d

File tree

Expand file treeCollapse file tree

3 files changed

+13
-10
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+13
-10
lines changed

‎src/Symfony/Component/Yaml/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
3.0.0
5+
-----
6+
7+
* Yaml::parse() now throws an exception when a blackslash is not escaped
8+
in double-quoted strings
9+
410
2.8.0
511
-----
612

‎src/Symfony/Component/Yaml/Tests/InlineTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Tests/InlineTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ public function testHashStringsResemblingExponentialNumericsShouldNotBeChangedTo
7171
}
7272

7373
/**
74-
* @group legacy
75-
* throws \Symfony\Component\Yaml\Exception\ParseException in 3.0
74+
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
75+
* @expectedExceptionMessage Found unknown escape character "\V".
7676
*/
7777
public function testParseScalarWithNonEscapedBlackslashShouldThrowException()
7878
{
79-
$this->assertSame('Foo\Var', Inline::parse('"Foo\Var"'));
79+
Inline::parse('"Foo\Var"');
8080
}
8181

8282
/**

‎src/Symfony/Component/Yaml/Unescaper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Unescaper.php
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Yaml;
1313

14+
use Symfony\Component\Yaml\Exception\ParseException;
15+
1416
/**
1517
* Unescaper encapsulates unescaping rules for single and double-quoted
1618
* YAML strings.
@@ -59,11 +61,8 @@ public function unescapeDoubleQuotedString($value)
5961
* @param string $value An escaped character
6062
*
6163
* @return string The unescaped character
62-
*
63-
* @internal This method is public to be usable as callback. It should not
64-
* be used in user code. Should be changed in 3.0.
6564
*/
66-
public function unescapeCharacter($value)
65+
private function unescapeCharacter($value)
6766
{
6867
switch ($value[1]) {
6968
case '0':
@@ -113,9 +112,7 @@ public function unescapeCharacter($value)
113112
case 'U':
114113
return self::utf8chr(hexdec(substr($value, 2, 8)));
115114
default:
116-
@trigger_error('Not escaping a backslash in a double-quoted string is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.', E_USER_DEPRECATED);
117-
118-
return $value;
115+
throw new ParseException(sprintf('Found unknown escape character "%s".', $value));
119116
}
120117
}
121118

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.