diff --git a/src/Symfony/Bundle/FrameworkBundle/EventListener/ConsoleProfilerListener.php b/src/Symfony/Bundle/FrameworkBundle/EventListener/ConsoleProfilerListener.php index d3fc3810631b6..869bd73c8c951 100644 --- a/src/Symfony/Bundle/FrameworkBundle/EventListener/ConsoleProfilerListener.php +++ b/src/Symfony/Bundle/FrameworkBundle/EventListener/ConsoleProfilerListener.php @@ -42,6 +42,7 @@ public function __construct( private readonly Profiler $profiler, private readonly RequestStack $requestStack, private readonly Stopwatch $stopwatch, + private readonly bool $cliMode, private readonly UrlGeneratorInterface $urlGenerator, ) { $this->profiles = new \SplObjectStorage(); @@ -59,6 +60,10 @@ public static function getSubscribedEvents(): array public function initialize(ConsoleCommandEvent $event): void { + if (!$this->cliMode) { + return; + } + $input = $event->getInput(); if (!$input->hasOption('profile') || !$input->getOption('profile')) { $this->profiler->disable(); @@ -78,12 +83,16 @@ public function initialize(ConsoleCommandEvent $event): void public function catch(ConsoleErrorEvent $event): void { + if (!$this->cliMode) { + return; + } + $this->error = $event->getError(); } public function profile(ConsoleTerminateEvent $event): void { - if (!$this->profiler->isEnabled()) { + if (!$this->cliMode || !$this->profiler->isEnabled()) { return; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/profiling.php b/src/Symfony/Bundle/FrameworkBundle/Resources/config/profiling.php index ec764d8375665..d863cd8b1db7e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/profiling.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/profiling.php @@ -43,6 +43,7 @@ service('profiler'), service('.virtual_request_stack'), service('debug.stopwatch'), + param('kernel.runtime_mode.cli'), service('router'), ]) ->tag('kernel.event_subscriber')
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: