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
Report use of binary number format in PHP < 5.4 #55
Comments
Checks for: * binary integers which were introduced in PHP 5.4 * invalid octal integers which were truncated prior to PHP 7 and give a parse error in 7. * hexadecimal numeric strings for which the type juggling behaviour and recognition as numeric was inconsistent prior to PHP 7 and are no longer treated as numeric in PHP 7+. Includes unit tests. Closes PHPCompatibility#55
Checks for: * binary integers which were introduced in PHP 5.4 * invalid octal integers which were truncated prior to PHP 7 and give a parse error in 7. * hexadecimal numeric strings for which the type juggling behaviour and recognition as numeric was inconsistent prior to PHP 7 and are no longer treated as numeric in PHP 7+. Includes unit tests. Closes PHPCompatibility#55
Checks for: * binary integers which were introduced in PHP 5.4 * invalid binary integers * invalid octal integers which were truncated prior to PHP 7 and give a parse error in 7. * hexadecimal numeric strings for which the type juggling behaviour and recognition as numeric was inconsistent prior to PHP 7 and are no longer treated as numeric in PHP 7+. Includes unit tests. Closes PHPCompatibility#55
I've been working on this (and some other integer related checks), but am currently staring myself blind at trying to figure out why the unit tests aren't passing... If anyone feels like having a look, that would be much appreciated. Work in progress branch (unclean, contains some debug code and such): Travis run of the unit tests which is failing on the binary int tests: Alternative travis run where I'm running the actual sniff over the test file with various The stupid things is that in the alternative run the errors which we're testing for are being generated correctly for the version where we'd expect them, but when running the unit tests, they seem to be missing. I did the alternative travis run to see if there was a difference between the results on the travis platform and the results I'm getting locally (there is not) as I can't figure out why the unit tests are not finding the error messages. Probably something really small and stupid, but I ain't seeing it 😖 😱 |
Checks for: * binary integers which were introduced in PHP 5.4 * invalid binary integers * invalid octal integers which were truncated prior to PHP 7 and give a parse error in 7. * hexadecimal numeric strings for which the type juggling behaviour and recognition as numeric was inconsistent prior to PHP 7 and are no longer treated as numeric in PHP 7+. Includes unit tests. Closes PHPCompatibility#55
Checks for: * binary integers which were introduced in PHP 5.4 * invalid binary integers * invalid octal integers which were truncated prior to PHP 7 (warning) and give a parse error in 7 (error). * hexadecimal numeric strings for which the type juggling behaviour and recognition as numeric was inconsistent prior to PHP 7 (warning) and are no longer treated as numeric in PHP 7+(error). Includes unit tests. Closes PHPCompatibility#55
Found it. See PR #160 |
PHP 5.4 introduced a new binary number format [1], e.g.
0b001001101
which is invalid syntax in earlier PHP versions.A sniff should be written to report this when targeting PHP < 5.4.
[1] http://php.net/manual/en/migration54.new-features.php
The text was updated successfully, but these errors were encountered: