File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -1170,7 +1170,9 @@ private function lexInlineQuotedString(int &$cursor = 0): string
11701170 for (; \strlen ($ this ->currentLine ) > $ cursor ; ++$ cursor ) {
11711171 switch ($ this ->currentLine [$ cursor ]) {
11721172 case '\\' :
1173- if (isset ($ this ->currentLine [++$ cursor ])) {
1173+ if ("' " === $ quotation ) {
1174+ $ value .= '\\' ;
1175+ } elseif (isset ($ this ->currentLine [++$ cursor ])) {
11741176 $ value .= '\\' .$ this ->currentLine [$ cursor ];
11751177 }
11761178
Original file line number Diff line number Diff line change @@ -1618,6 +1618,11 @@ public function escapedQuotationCharactersInQuotedStrings()
16181618 ];
16191619 }
16201620
1621+ public function testBackslashInSingleQuotedString ()
1622+ {
1623+ $ this ->assertSame (['foo ' => 'bar \\' ], $ this ->parser ->parse ("foo: 'bar\' " ));
1624+ }
1625+
16211626 public function testParseMultiLineString ()
16221627 {
16231628 $ this ->assertEquals ("foo bar \nbaz " , $ this ->parser ->parse ("foo \nbar \n\nbaz " ));
You can’t perform that action at this time.
0 commit comments