Skip to content

Commit 0258dc1

Browse files
committed
Extractor: fix escaping quotes when converting to double quoted string [Closes #151]
1 parent 7b931d6 commit 0258dc1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/PhpGenerator/Extractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private function prepareReplacements(array $nodes, int $level): array
132132
$replacements[] = [
133133
$node->getStartFilePos() - $start,
134134
$node->getEndFilePos() - $start,
135-
'"' . addcslashes($node->value, "\x00..\x1F") . '"',
135+
'"' . addcslashes($node->value, "\x00..\x1F\"") . '"',
136136
];
137137

138138
} elseif (

tests/PhpGenerator/Extractor.strings.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ $extractor = new Extractor(<<<'XX'
1414
{
1515
$s = '
1616
a
17-
b
17+
b"\'
1818
c
1919
';
2020
2121
$d = "
2222
a
23-
b
23+
b\"'
2424
c
2525
";
2626
@@ -91,9 +91,9 @@ $extractor = new Extractor(<<<'XX'
9191

9292
Assert::match(
9393
<<<'XX'
94-
$s = "\na\n\tb\n\t\tc\n";
94+
$s = "\na\n\tb\"'\n\t\tc\n";
9595
96-
$d = "\na\n\tb\n\t\tc\n";
96+
$d = "\na\n\tb\"'\n\t\tc\n";
9797
9898
$id = "\na\n\t{$b}\n\t\t$c\n";
9999
XX,

0 commit comments

Comments
 (0)