Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: disable xdebug trigger for xdebug and xhprof status checks, fixes #6191, fixes php-perfect/ddev-intellij-plugin#414#7216

Merged
stasadev merged 1 commit intoddev:mainfrom
AkibaAT:20250417_akibaat_fix_xdebug_triggers
Apr 18, 2025
Merged

fix: disable xdebug trigger for xdebug and xhprof status checks, fixes #6191, fixes php-perfect/ddev-intellij-plugin#414#7216
stasadev merged 1 commit intoddev:mainfrom
AkibaAT:20250417_akibaat_fix_xdebug_triggers

Conversation

@AkibaAT
Copy link
Contributor

@AkibaAT AkibaAT commented Apr 17, 2025

The Issue

When xdebug is enabled, DDEV internal executions of PHP code are not excluded from debugging, causing unexpected debugging connections in the IDE.

How This PR Solves The Issue

  • Add flags to disable xdebug connections for status checks of xdebug itself, works for xdebug 2 and 3.
  • Add ENV to disable xdebug for status checks of xhprof, works only for xdebug 3.
    For xdebug 2 support, we'd first need to figure out the xdebug version. Seeing as the composer command also implements the xdebug 3 only solution, this is what I went with here as well.

Manual Testing Instructions

Setup:
Take any ddev project, can also be a completely new and blank one
ddev config global --xhprof-mode=xhgui
ddev start
ddev xdebug on
Enable xdebug listen in PhpStorm

Test the following commands. Running either causes a debug connection in the IDE with DDEV 1.24.4 that looks like the screenshot, while no longer creating one with this version:
ddev xdebug status
ddev describe
image

ddev describe is called by the PhpStorm plugin in regular intervals to watch the project's status, so stopping debugging connections from happening here resolves ddev/ddev-intellij-plugin#414

Automated Testing Overview

Might be useful. That the changes don't break existing functionality is already covered by existing tests. What isn't tested, is that they remove the xdebug connection attempt.

Release/Deployment Notes

No change for deployment, the commands behave as before, minus the debugging connections.

@AkibaAT AkibaAT requested a review from a team as a code owner April 17, 2025 21:28
@rfay rfay changed the title fix: disable xdebug trigger for xdebug and xhprof status checks, fixes #6191 fix: disable xdebug trigger for xdebug and xhprof status checks, fixes #6191, fixes php-perfect/ddev-intellij-plugin#414 Apr 17, 2025
Copy link
Member

@rfay rfay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks correct to me and tests great. Please do update the OP manual testing instructions to explain what should and should not happen, and what is happening to PhpStorm with the plugin installed, thanks!

@rfay rfay requested a review from stasadev April 17, 2025 22:03
Copy link
Member

@stasadev stasadev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @AkibaAT and @rfay.

Really great effort on resolving such a tricky issue!

I was able to reliably reproduce the problem with Xdebug 3 (but not with Xdebug 2), and now debugging works perfectly with both versions.

@stasadev stasadev merged commit ff3655c into ddev:main Apr 18, 2025
34 checks passed
@AkibaAT AkibaAT deleted the 20250417_akibaat_fix_xdebug_triggers branch April 23, 2025 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Xdebug stopping on random incoming connections from stdin and composer when using command line input

3 participants

Comments