bug #37353 [DI] disable preload.php on the CLI (nicolas-grekas)

This PR was merged into the 4.4 branch.

Discussion
----------

[DI] disable preload.php on the CLI

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #37152
| License       | MIT
| Doc PR        | -

See linked issue for a nasty side-effect of preloading on the CLI. Many hosting solutions do not provide a way to set different ini settings for CLI vs FPM. Let's skip preloading anything on the CLI.

Commits
-------

50ccf2f1b2 [DI] disable preload.php on the CLI
This commit is contained in:
Fabien Potencier 2020-06-19 16:51:13 +02:00
commit b690a4a352
1 changed files with 4 additions and 0 deletions

View File

@ -319,6 +319,10 @@ EOF;
use Symfony\Component\DependencyInjection\Dumper\Preloader;
if (in_array(PHP_SAPI, ['cli', 'phpdbg'], true)) {
return;
}
require $autoloadFile;
require __DIR__.'/Container{$hash}/{$options['class']}.php';