Skip to content

Commit 38387d7

Browse files
committed
Merge branch 'PHP-7.4'
2 parents 03e92d4 + 1b08ab2 commit 38387d7

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
No warnings should be thrown during heredoc scan-ahead
3+
--FILE--
4+
<?php
5+
6+
<<<TEST
7+
${x}
8+
\400
9+
${/*}
10+
TEST;
11+
12+
?>
13+
--EXPECTF--
14+
Warning: Unexpected character in input: '' (ASCII=1) state=0 in %s on line %d
15+
16+
Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d
17+
18+
Warning: Unterminated comment starting line %d in %s on line %d
19+
20+
Parse error: syntax error, unexpected end of file in %s on line %d

Zend/zend_language_scanner.l

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2179,7 +2179,7 @@ inline_char_handler:
21792179

21802180
if (YYCURSOR < YYLIMIT) {
21812181
YYCURSOR++;
2182-
} else {
2182+
} else if (!SCNG(heredoc_scan_ahead)) {
21832183
zend_error(E_COMPILE_WARNING, "Unterminated comment starting line %d", CG(zend_lineno));
21842184
}
21852185

@@ -2833,7 +2833,9 @@ nowdoc_scan_done:
28332833
RETURN_TOKEN(END);
28342834
}
28352835
2836-
zend_error(E_COMPILE_WARNING, "Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
2836+
if (!SCNG(heredoc_scan_ahead)) {
2837+
zend_error(E_COMPILE_WARNING, "Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
2838+
}
28372839
if (PARSER_MODE()) {
28382840
goto restart;
28392841
} else {

0 commit comments

Comments
 (0)