mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-26 20:14:46 +01:00
Fix PHP 8 compatibility
This is a fix to preserve current behavior, but this should be changed towards doing the same as PHP 8 does.
This commit is contained in:
parent
2f45e05042
commit
0a80b2d8ee
@ -143,6 +143,16 @@ class Lexer
|
||||
return true;
|
||||
}
|
||||
|
||||
if (PHP_VERSION_ID >= 80000) {
|
||||
// PHP 8 converts the "bad character" case into a parse error, rather than treating
|
||||
// it as a lexing warning. To preserve previous behavior, we need to assume that an
|
||||
// error occurred.
|
||||
// TODO: We should handle this the same way as PHP 8: Only generate T_BAD_CHARACTER
|
||||
// token here (for older PHP versions) and leave generationg of the actual parse error
|
||||
// to the parser. This will also save the full token scan on PHP 8 here.
|
||||
return true;
|
||||
}
|
||||
|
||||
return null !== error_get_last();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user