diff options
| -rw-r--r-- | Zend/tests/warning_during_heredoc_scan_ahead.phpt | 20 | ||||
| -rw-r--r-- | Zend/zend_language_scanner.l | 6 |
2 files changed, 24 insertions, 2 deletions
diff --git a/Zend/tests/warning_during_heredoc_scan_ahead.phpt b/Zend/tests/warning_during_heredoc_scan_ahead.phpt new file mode 100644 index 0000000000..099d1c087f --- /dev/null +++ b/Zend/tests/warning_during_heredoc_scan_ahead.phpt @@ -0,0 +1,20 @@ +--TEST-- +No warnings should be thrown during heredoc scan-ahead +--FILE-- +<?php + +<<<TEST +${x} +\400 +${/*} +TEST; + +?> +--EXPECTF-- +Warning: Unexpected character in input: '' (ASCII=1) state=0 in %s on line %d + +Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d + +Warning: Unterminated comment starting line %d in %s on line %d + +Parse error: syntax error, unexpected end of file in %s on line %d diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 86b8bb1a70..bfe71705b9 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -2179,7 +2179,7 @@ inline_char_handler: if (YYCURSOR < YYLIMIT) { YYCURSOR++; - } else { + } else if (!SCNG(heredoc_scan_ahead)) { zend_error(E_COMPILE_WARNING, "Unterminated comment starting line %d", CG(zend_lineno)); } @@ -2833,7 +2833,9 @@ nowdoc_scan_done: RETURN_TOKEN(END); } - zend_error(E_COMPILE_WARNING, "Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); + if (!SCNG(heredoc_scan_ahead)) { + zend_error(E_COMPILE_WARNING, "Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); + } if (PARSER_MODE()) { goto restart; } else { |
