Skip to content

Commit b690a4a

Browse files
committed
bug symfony#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 symfony#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 ------- 50ccf2f [DI] disable preload.php on the CLI
2 parents a2c2393 + 50ccf2f commit b690a4a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,10 @@ public function dump(array $options = [])
319319
320320
use Symfony\Component\DependencyInjection\Dumper\Preloader;
321321
322+
if (in_array(PHP_SAPI, ['cli', 'phpdbg'], true)) {
323+
return;
324+
}
325+
322326
require $autoloadFile;
323327
require __DIR__.'/Container{$hash}/{$options['class']}.php';
324328

0 commit comments

Comments
 (0)