Skip to content

Commit 13a5dd2

Browse files
bug #62692 [FrameworkBundle] Enable console profiling only if the console is actually available (dbu)
This PR was merged into the 7.4 branch. Discussion ---------- [FrameworkBundle] Enable console profiling only if the console is actually available | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT The FrameworkExtension is generally aware that symfony/console is an optional dependency, but when the profiler is loaded, it loads the console profiler unconditionally. this has been broken [when the check for CliRequest::class was removed](ea5a3cc) but not replaced with an other check for availability of the console Commits ------- 5ab5322 only load console profiling if console is actually available
2 parents 663ec5d + 5ab5322 commit 13a5dd2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ public function load(array $configs, ContainerBuilder $container): void
646646
$this->registerNotifierConfiguration($config['notifier'], $container, $loader, $this->readConfigEnabled('webhook', $container, $config['webhook']));
647647
}
648648

649-
// profiler depends on form, validation, translation, messenger, mailer, http-client, notifier, serializer being registered
649+
// profiler depends on form, validation, translation, messenger, mailer, http-client, notifier, serializer being registered. console is optional
650650
$this->registerProfilerConfiguration($config['profiler'], $container, $loader);
651651

652652
if ($this->readConfigEnabled('webhook', $container, $config['webhook'])) {
@@ -1078,7 +1078,7 @@ private function registerProfilerConfiguration(array $config, ContainerBuilder $
10781078
$container->getDefinition('profiler_listener')
10791079
->addArgument($config['collect_parameter']);
10801080

1081-
if (!$container->getParameter('kernel.debug') || !class_exists(CliRequest::class) || !$container->has('debug.stopwatch')) {
1081+
if (!$container->getParameter('kernel.debug') || !$this->hasConsole() || !class_exists(CliRequest::class) || !$container->has('debug.stopwatch')) {
10821082
$container->removeDefinition('console_profiler_listener');
10831083
}
10841084

0 commit comments

Comments
 (0)