Skip to content

Commit 179b553

Browse files
committed
bug symfony#61529 [FrameworkBundle] Don’t collect CLI profiles if the profiler is disabled (MatTheCat)
This PR was merged into the 6.4 branch. Discussion ---------- [FrameworkBundle] Don’t collect CLI profiles if the profiler is disabled | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix symfony#60409 | License | MIT symfony#59515 removed the check for the profiler being enabled, but if it isn’t its `collect` method will return `null` and the `ConsoleProfilerListener` will crash when trying to call `saveProfile`. Commits ------- e18ce44 [FrameworkBundle] Don’t collect CLI profiles if the profiler is disabled
2 parents 5c143ba + e18ce44 commit 179b553

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/EventListener/ConsoleProfilerListener.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ public function profile(ConsoleTerminateEvent $event): void
109109
return;
110110
}
111111

112+
if (!$this->profiler->isEnabled()) {
113+
return;
114+
}
115+
112116
if (null !== $sectionId = $request->attributes->get('_stopwatch_token')) {
113117
// we must close the section before saving the profile to allow late collect
114118
try {

0 commit comments

Comments
 (0)