Skip to content

Commit e0a4013

Browse files
committed
Make "unterminated comment" into a parse error
1 parent 93ba3ab commit e0a4013

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

Zend/tests/unterminated_comment.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--TEST--
2+
Unterminated comment
3+
--FILE--
4+
<?php
5+
/* Foo
6+
Bar
7+
--EXPECTF--
8+
Parse error: Unterminated comment starting line 2 in %s on line %d

Zend/tests/warning_during_heredoc_scan_ahead.phpt

Lines changed: 0 additions & 17 deletions
This file was deleted.

Zend/zend_language_scanner.l

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,8 +2190,11 @@ inline_char_handler:
21902190

21912191
if (YYCURSOR < YYLIMIT) {
21922192
YYCURSOR++;
2193-
} else if (!SCNG(heredoc_scan_ahead)) {
2194-
zend_error(E_COMPILE_WARNING, "Unterminated comment starting line %d", CG(zend_lineno));
2193+
} else {
2194+
zend_throw_exception_ex(zend_ce_parse_error, 0, "Unterminated comment starting line %d", CG(zend_lineno));
2195+
if (PARSER_MODE()) {
2196+
RETURN_TOKEN(T_ERROR);
2197+
}
21952198
}
21962199

21972200
yyleng = YYCURSOR - SCNG(yy_text);

0 commit comments

Comments
 (0)