xdebug / vscode-php-debug

PHP Debug Adapter for Visual Studio Code 🐞⛔
MIT License
780 stars 178 forks source link

Port 0 is not working #857

Closed jnagler closed 1 year ago

jnagler commented 1 year ago
{
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 0
}

behaves as no port setting was given and falls back to try 9003, then 9000 and fails if none of both is available, e.g. if 9000 is available

Listening to Xdebug on 0.0.0.0:9003 failed: Error: listen EADDRINUSE: address already in use 0.0.0.0:9003
Listening to Xdebug on :::9003 failed: Error: listen EADDRINUSE: address already in use :::9003
Listening to Xdebug on port 0.0.0.0:9000 ...

I just realized that a configuration of

{
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": "0"
}

works although port is supposed to be a number.

Listening to Xdebug on port 0.0.0.0:41799,:::33447 ...
zobo commented 1 year ago

Same as the other issue. Are you sure you are using this extension? The output does not seem right.

jnagler commented 1 year ago

Yes, you were right. Actually devsense.phptools seems also to be a debug adapter and with both yours and this installed I had no clue which one is used. Temporarily disabling devsense showed that your port 0 feature is working as expected and the error is with devsense's interpreting those settings.