8000 bug #36560 [YAML] escape DEL(\x7f) (sdkawata) · symfony/symfony@fe5eacd · GitHub
[go: up one dir, main page]

Skip to content

Commit fe5eacd

Browse files
committed
bug #36560 [YAML] escape DEL(\x7f) (sdkawata)
This PR was merged into the 3.4 branch. Discussion ---------- [YAML] escape DEL(\x7f) | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #36559 | License | MIT | Doc PR | none Commits ------- 734d97b [YAML] escape DEL(\x7f)
2 parents 719bb15 + 734d97b commit fe5eacd

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Symfony/Component/Yaml/Escaper.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
class Escaper
2323
{
2424
// Characters that would cause a dumped string to require double quoting.
25-
const REGEX_CHARACTER_TO_ESCAPE = "[\\x00-\\x1f]|\xc2\x85|\xc2\xa0|\xe2\x80\xa8|\xe2\x80\xa9";
25+
const REGEX_CHARACTER_TO_ESCAPE = "[\\x00-\\x1f]|\x7f|\xc2\x85|\xc2\xa0|\xe2\x80\xa8|\xe2\x80\xa9";
2626

2727
// Mapping arrays for escaping a double quoted string. The backslash is
2828
// first to ensure proper escaping because str_replace operates iteratively
@@ -33,13 +33,15 @@ class Escaper
3333
"\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f",
3434
"\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17",
3535
"\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f",
36+
"\x7f",
3637
"\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9",
3738
];
3839
private static $escaped = ['\\\\', '\\"', '\\\\', '\\"',
3940
'\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a',
4041
'\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f',
4142
'\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17',
4243
'\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f',
44+
'\\x7f',
4345
'\\N', '\\_', '\\L', '\\P',
4446
];
4547

src/Symfony/Component/Yaml/Tests/DumperTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ public function getEscapeSequences()
289289
'double-quote' => ['"', "'\"'"],
290290
'slash' => ['/', '/'],
291291
'backslash' => ['\\', '\\'],
292+
'del' => ["\x7f", '"\x7f"'],
292293
'next-line' => ["\xC2\x85", '"\\N"'],
293294
'non-breaking-space' => ["\xc2\xa0", '"\\_"'],
294295
'line-separator' => ["\xE2\x80\xA8", '"\\L"'],

0 commit comments

Comments
 (0)
0