Getting “ERR_CONNECTION_RESET” error with specific xdebug versions

While updating my PHP dev environment by updating PHP and Xdebug versions, I encountered this error “ERR_CONNECTION_RESET” while debugging.

Context: debugging a PrestaShop project.

Old versions (no issue):

  • PHP 7.4.33-Win32-vc15-x64
  • Xdebug 3.1.6-7.4-vc15-x86_64

New versions (“ERR_CONNECTION_RESET” displayed on the browser):

  • PHP 8.1.32-Win32-vs16-x64
  • Xdebug 3.4.2-8.1-ts-vs16-x86_64 (latest version at the time of writing this thread)

The strange thing is that I get this error mainly when I’m debugging the PrestaShop back-office. When I debug the PrestaShop front-office, the error may sometimes appear then disappear, but it was not blocking, as the debugging continues.

Troubleshooting after upgrading to the newer versions:

  • With the setup PHP 8.1.32-Win32-vs16-x64 and Xdebug 3.4.2-8.1-ts-vs16-x86_64: I tried with different browsers (Edge and Chrome) and I’m still getting the error => browser cause discarded.
  • With the setup PHP 8.1.32-Win32-vs16-x64 and Xdebug 3.4.2-8.1-ts-vs16-x86_64: I tried with different IDEs (PhpStorm and VSCode) and I’m still getting the error => IDE cause discarded.
  • Since Xdebug 3.1.6-7.4-vc15-x86_64 is working with PHP 7.4.33 (my previous setup): I tried xdebug-3.1.6-8.1-vs16-x86_64 with PHP 8.1.32, and the debugging worked without any error => Cause identified: it is the Xdebug version.

So I ended up with this setup that is working:

  • PHP 8.1.32-Win32-vs16-x64
  • Xdebug 3.1.6-8.1-vs16-x86_64

I assume that there is an issue with some Xdebug versions (at least the latest at the moment of writing this thread: Xdebug 3.4.2-8.1-ts-vs16-x86_64).

Similar issue reported in previous version here https://bugs.xdebug.org/view.php?id=2024

The workaround is to downgrade the Xdebug version (of course by choosing a version that matches project PHP version).

Others used the same workaround as stated here https://www.reddit.com/r/PHPhelp/comments/q4cd85/xdebug_causing_err_connection_reset/

I don’t know where to submit this issue to get it fixed (or at least investigated). Please share if you know where to do it.

Also, please share if you have a better solution.

Hope this helps!