Disable Xdebug in subprocesses when it is not used #5989
Closed
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
before this PR xdebug was only auto-disabled for PHPT.
as of this PR we disable xdebug for all sub-processes to make them faster - but only if no active debugger is attached.
this means subprocess isolated tests can still be debugged without the need for a additional cli-option or config setting changed just by attaching e.g. PHPStorm (so no change in DX).
I initially tried disabling xdebug for the whole sub-process by not loading the extension at all, but this would either require a new composer/xdebug-handler dependency or a way more involved fix.
disabling xdebug already provides most perf benefits.
Benchmark (xdebug loaded, but no debugger attached):
/c/tools/php83/php phpunit tests/end-to-end/data-provider/log-junit-isolation.phpt
with phpunit@a82cc0548 takes 2.5 - 2.6 seconds (phpunit reported runtime)After this PR:
/c/tools/php83/php phpunit tests/end-to-end/data-provider/log-junit-isolation.phpt
takes 0.5-0.6 secondstested with PHP 8.3.11 with Xdebug v3.4.0beta1 on windows11x64
php.ini settings: