Skip to content
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

php_codesniffer 3.9 with standard PHPCompatibility seems not taking into account the target PHP 8.3 #398

Closed
philprl opened this issue Mar 15, 2024 · 4 comments

Comments

@philprl
Copy link

philprl commented Mar 15, 2024

Describe the bug

Warnings about deprecated features or removed obsolete functionnalities of PHP code seem to be not reported with php_codesniffer 3.9 using standard PHPCompatibilty on target PHP 8.3.
None warning is reported in the log file by the following command :
phpcs "C:\path_to_PHP_code" -d memory_limit=1G --extensions=php --standard=PHPCompatibility --runtime-set testVersion 8.3 --report-file=phpcs.log
N.B.:
I don't know that it is a bug or not, I am simply submitting here what I have encountered while checking my PHP code for compatibility with PHP 8.3.

Code sample

...
$ldapHost = "ldap://annuaire.sesam-vitale.fr";
$ldapPort = 389;
$ds = ldap_connect($ldapHost,$ldapPort);
...

Custom ruleset

None custom ruleset used

To reproduce

Steps to reproduce the behavior:

  1. Create a file called test.php with the code sample above...
  2. Run phpcs test.php -d memory_limit=1G --extensions=php --standard=PHPCompatibility --runtime-set testVersion 8.3 --report-file=phpcs.log
  3. See error message displayed
  4. See content of report file

PHPCS output here
None error displayed (the command executed normally), but none warning of deprecated code in the report file phpcs.log

Expected behavior

The following lines of message ought to be written in the report file phpcs.log :
FILE: test.php

FOUND 0 ERRORS AND 1 WARNINGS AFFECTING 1 LINE

4 | WARNING | Usage of ldap_connect with two arguments is deprecated

Versions (please complete the following information)

| Operating System | PHP version | PHP_CodeSniffer version | Standard | Install type |
| Windows 10 | 8.3 | 3.9.0 | MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend and PHPCompatibility (given by phpcs -i) | Composer (global) |

Additional context

When testing PHP code written in PHP 7.4 using PHP_CodeSniffer 2.7 with PHPCompatibility on target PHP 8.1, the problem was not encountered: warnings on deprecated code PHP 7.4 were well reported

Please confirm:

  • I have searched the issue list and am not opening a duplicate issue.
@jrfnl
Copy link
Member

jrfnl commented Mar 15, 2024

It is unclear what your issue is.

Is the issues that the deprecation is reported, but not written to the log file ? Or is your issue that the deprecation isn't being reported ?

If the later, I suggest closing this issue as reported to the wrong repo. Issues with PHPCompatibility should be reported in their repo: https://github.com/PHPCompatibility/PHPCompatibility/issues

Oh and you may also want to have a look at: PHPCompatibility/PHPCompatibility#1589

@philprl
Copy link
Author

philprl commented Mar 15, 2024 via email

@jrfnl
Copy link
Member

jrfnl commented Mar 15, 2024

@philprl In which case you are reporting this in the wrong repo.

@philprl
Copy link
Author

philprl commented Mar 15, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants