-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
apply php configurations when fork child workers #559
Conversation
I'd also find this useful, since PHPStan and JIT don't work so well together on Windows, and it's tiresome to have to disable it in php.ini. |
Looks like you have a different root issue @dktapps that should be addressed. |
src/Process/ProcessHelper.php
Outdated
@@ -24,8 +24,11 @@ public static function getWorkerCommand( | |||
InputInterface $input | |||
): string | |||
{ | |||
$phpIni = php_ini_loaded_file(); | |||
$phpCmd = ($phpIni === false) ? escapeshellarg(PHP_BINARY) : sprintf('%s -c %s', escapeshellarg(PHP_BINARY), $phpIni); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$phpIni
needs to be escaped as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yes, you are right, let me fix it.
I know, but I've been unsuccessful at identifying the root cause of the problem after several months of investigation. I know it has something to do with subprocesses, but I'm not sure exactly what - something leads to PHP segfaulting in PM analysis runs. I end up disabling JIT as a workaround, but PHPStan makes that difficult due to not passing CLI arguments to subprocesses. |
Thank you! |
Currently, ProcessHelper only copy command-line arguments of phpstan, but ignore those of php itself.
In some cases, the custom configuration for php: --configuration (-c in short), is very usefull.
for example:
If a custom php.ini is specified when starting phpstan like:
php74 -c my-php.ini analyze --level 0 ...
my-php.ini
extension=yaf
yaf.use_namespace = On
...
phpstan creates child workers to analyze, however, it only copies its own the command-line arguments, not those of php itself (-c my-php.ini).
In workers, "yaf.use_namespace" could not take effect, the reference to "Yaf\Application" will generate "Yaf\Application not found" error message.