mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-01-17 15:18:17 +01:00
parent
17f478107a
commit
739b4b4c60
@ -7,6 +7,10 @@ Version 4.7.0-dev
|
||||
* [PHP 8.0] Added support for match expressions. These are represented using a new `Expr\Match_`
|
||||
containing `MatchArm`s.
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed missing error for unterminated comment with trailing newline (#688).
|
||||
|
||||
Version 4.6.0 (2020-07-02)
|
||||
--------------------------
|
||||
|
||||
|
@ -152,7 +152,8 @@ class Lexer
|
||||
$this->handleInvalidCharacterRange($filePos, $filePos + 1, $line, $errorHandler);
|
||||
}
|
||||
|
||||
if ($token[0] === \T_COMMENT && preg_match('/(\r\n|\n|\r)$/D', $token[1], $matches)) {
|
||||
if ($token[0] === \T_COMMENT && substr($token[1], 0, 2) !== '/*'
|
||||
&& preg_match('/(\r\n|\n|\r)$/D', $token[1], $matches)) {
|
||||
$trailingNewline = $matches[0];
|
||||
$token[1] = substr($token[1], 0, -strlen($trailingNewline));
|
||||
$this->tokens[$i] = $token;
|
||||
|
@ -35,6 +35,7 @@ class LexerTest extends \PHPUnit\Framework\TestCase
|
||||
public function provideTestError() {
|
||||
return [
|
||||
["<?php /*", ["Unterminated comment from 1:7 to 1:9"]],
|
||||
["<?php /*\n", ["Unterminated comment from 1:7 to 2:1"]],
|
||||
["<?php \1", ["Unexpected character \"\1\" (ASCII 1) from 1:7 to 1:7"]],
|
||||
["<?php \0", ["Unexpected null byte from 1:7 to 1:7"]],
|
||||
// Error with potentially emulated token
|
||||
|
Loading…
x
Reference in New Issue
Block a user