-
-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The constant "T_BAD_CHARACTER" is removed since PHP 7.0 #1351
Comments
any fix yet ? |
From what I can tell, |
I believe the only way to fix this is to remove This is because the
This would have the side effect of not properly alerting users of PHP 7.0, 7.1, 7.2, and 7.3 if they happened to be using this removed constant but given that those versions have been EOL for several years now I think this is the correct approach. |
@kevin-j-morse No, the constant needs to be special cased in both the |
@jrfnl is there any documentation on how this special casing works? I looked through the other constants and I couldn't see any other examples where this is the case. |
@kevin-j-morse Correct. It's never been needed before (no PHP constant has ever been removed and then re-added other than this one), so the special casing is a new feature which will need to be build into the sniffs (which is also why this hasn't been actioned (yet) as it's not so straight forward as just adding to one of the lists). |
Bug Description
Running PHP compatibility check is resulting in the following errors with PHP 8.1.
nikic/php-parser/lib/PhpParser/Lexer.php
46 | ERROR | The constant "T_BAD_CHARACTER" is removed since PHP 7.0
109 | ERROR | The constant "T_BAD_CHARACTER" is removed since PHP 7.0
151 | ERROR | The constant "T_BAD_CHARACTER" is removed since PHP 7.0
This is supposedly added back in PHP 7.4.
Reference: nikic/PHP-Parser#701 (comment)
Given the following reproduction Scenario
Running PHPCS command on https://github.com/nikic/PHP-Parser/releases/tag/v4.15.1 is resulting an error.
The issue happens when running this command:
... over a file "nikic/php-parser/lib/PhpParser/Lexer.php".
... with this custom ruleset:
phpcs - 3.7.1, phpcompatibility - 9.3.5 (latest versions available).
Instead this happened
46 | ERROR | The constant "T_BAD_CHARACTER" is removed since PHP 7.0
109 | ERROR | The constant "T_BAD_CHARACTER" is removed since PHP 7.0
151 | ERROR | The constant "T_BAD_CHARACTER" is removed since PHP 7.0
Environment
Tested Against
develop
branch?develop
branch of PHPCompatibility.The text was updated successfully, but these errors were encountered: