Warning with xdebug enabled causes invalid json
Describe the bug
Produces "Xdebug: [Step Debug] Could not connect to debugging client. Tried: 127.0.0.1:9003 (through xdebug.client_host/xdebug.client_port) :-(" when running command:
/usr/local/bin/phpcs --report=json -q -s --encoding=UTF-8 --standard=/Users/rolle/Projects/airdev/content/themes/air-light/phpcs.xml --error-severity=5 --warning-severity=5 --stdin-path=/Users/rolle/Projects/airdev/content/themes/air-light/inc/includes/nav-walker.php
AFAIK phpcs cli doesn't really need xdebug but will produce error in Visual Studio Code (vscode-phpcs) because the command line client warns for not being able to connect to debugging client. This means vscode-phpcs cannot lint at all despite phpcs is working fine WITH the error.
Code sample
Any code.
Custom ruleset
To reproduce Steps to reproduce the behavior:
- Install xdebug
- Run
phpcs test.php ... - See error message displayed
PHPCS output here
Expected behavior
No errors, valid json with --report=json.
Versions (please complete the following information):
- OS: macOS Catalina 10.15.7
- PHP: 7.3.21
- PHPCS: 3.5.5 (stable)
- Standard: The installed coding standards are PEAR, Zend, PSR2, MySource, Squiz, PSR1, PSR12, PHPCompatibility, WordPress, WordPress-Extra, WordPress-Docs and WordPress-Core
Additional context
Also asked here.
This error isn't coming from PHP_CodeSniffer. PHPCS does not use xdebug in any way.
This is likely a PHP or VSCode configuration issue, so closing as there isn't any change I can make to help you here.
Hello @ronilaukkarinen,I'm facing the same issue. Can you help me out?
Hello @ronilaukkarinen,I'm facing the same issue. Can you help me out?
We don't have this problem any more, this was 3 years ago. You can check out the possible workaround here. Sorry that I can't be more of help here.
Hello @ronilaukkarinen,I'm facing the same issue. Can you help me out?
We don't have this problem any more, this was 3 years ago. You can check out the possible workaround here. Sorry that I can't be more of help here.
Thanks for reply.