apply php configurations when fork child workers#559
apply php configurations when fork child workers#559ondrejmirtes merged 3 commits intophpstan:masterfrom yangchaobj:master
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
| ): 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.
$phpIni needs to be escaped as well
There was a problem hiding this comment.
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.