PHP doesn't handle octals very well. Basically, it seems that any numeric scalar matching /^0\d+$/ will be treated as an octal, whereas this should be /^0[0-7]+$/. As a result, 08 and 09 are both treated as 0 (because they are invalid octals. This diff adds a linter rule to detect this abnormality.
Details
Details
- Reviewers
epriestley - Group Reviewers
Blessed Reviewers - Commits
- rARC560e4ae4919b: Add a linter rule for invalid octals
Added unit tests.
Diff Detail
Diff Detail
- Repository
- rARC Arcanist
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
src/lint/linter/xhpast/rules/__tests__/invalid-octal-numeric-scalar/octal.lint-test | ||
---|---|---|
4–5 | Maybe include these test cases? 0 0.9 0xFf 0XFf 0b01 -08 |