Repository navigation
Pass xdebug, pcov and uopz startup switches on to workers and restarts - #6931
Merged
Merged
Conversation
php -d xdebug.mode=off leaves the main process nothing to restart for, but spawned workers load only the php.ini and do not restart themselves, so they ran with the php.ini's armed xdebug. Before RestartManager, each worker ran XdebugHandler on its own and restarted without xdebug. Amp-Thread-ID: https://ampcode.com/threads/T-01a1a349-2844-71e4-8763-34b8c84967e1
…mposes no ini A restart only loading the turbo extension re-executes PHP with the php.ini and memory_limit alone, so php -d xdebug.mode=off got the php.ini's armed xdebug back, and the restart marker then prevented the restart that would disarm it. Amp-Thread-ID: https://ampcode.com/threads/T-01a1a349-2844-71e4-8763-34b8c84967e1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Running
php -d xdebug.mode=off vendor/bin/phpstan analysewithxdebug.mode=debug,coveragein php.ini left xdebug armed in places RestartManager is supposed to keep clean.Spawned workers (Windows, or anywhere fork is not used). The main process sees
xdebug.mode=offand has nothing to restart for. Workers are spawned with-c php.iniandphpstan.restarted=1, so they get php.ini's armed xdebug and never restart themselves. Before RestartManager this was masked: every worker ran XdebugHandler inCommandHelper::begin()and restarted itself without xdebug.ProcessHelpernow passes the parent'sxdebug.mode,pcov.enabledanduopz.disableon as-d, for each loaded extension (RestartExtensionRegistry::getStartupSwitches()). Worker-dentries are now shell-escaped becausexdebug.modecan contain spaces.Restart that composes no ini (turbo is the only reason, e.g. the phar with OPcache not loaded).
getPassedThroughArguments()re-executed PHP with only-c php.ini -d memory_limit=…, so the main process and its forked workers got the armed xdebug back, and the restart marker blocked the restart that would disarm it. Before, XdebugHandler's later check restarted a second time. The same switches are now passed through there too.Reproduced both locally (pcntl disabled to spawn the way Windows does; a fake phar directory with a stand-in turbo binary for the second one) and checked both after the fix. Added a Windows row to the process restart E2E tests covering the spawned-worker case.