Commit 5ce9f2c
committed
Ruleset: prevent false positives on polyfill code
When `PHPCompatibility(PasswordCompat)` is run over the code in the `password_compat` repo itself, it will detect some non-issues.
```
FILE: password_compat\lib\password.php
------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 1 LINE
------------------------------------------------------------------------------------------
105 | ERROR | Extension 'mcrypt' is deprecated since PHP 7.1 and removed since PHP 7.2;
| | Use openssl (preferred) or pecl/mcrypt once available instead
| | (PHPCompatibility.Extensions.RemovedExtensions.mcryptDeprecatedRemoved)
105 | ERROR | Function mcrypt_create_iv() is deprecated since PHP 7.1 and removed since
| | PHP 7.2; Use random_bytes() or OpenSSL instead
| | (PHPCompatibility.FunctionUse.RemovedFunctions.mcrypt_create_ivDeprecatedRemoved)
105 | ERROR | The constant "MCRYPT_DEV_URANDOM" is deprecated since PHP 7.1 and removed
| | since PHP 7.2
| | (PHPCompatibility.Constants.RemovedConstants.mcrypt_dev_urandomDeprecatedRemoved)
------------------------------------------------------------------------------------------
```
The code in the `lib/password.php` file is all wrapped within `defined()` and/or `function_exists()` conditions and will never be executed on PHP 5.5+ as the functionality being polyfilled is by then provided natively by PHP.
This simple change prevents these non-issues from being reported.
This fix does rely on people having installed the code in a directory called `password_compat` or, for composer installs `password-compat`.1 parent 35f63c1 commit 5ce9f2c
1 file changed
+11
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
16 | 27 | | |
0 commit comments