Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fec8909

Browse filesBrowse files
committed
bug #52963 [FrameworkBundle] Fix profiling commands without router (HeahDude)
This PR was merged into the 6.4 branch. Discussion ---------- [FrameworkBundle] Fix profiling commands without router | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | #52943 | License | MIT Commits ------- 7fba074 [FrameworkBundle] Fix profiling commands without router
2 parents f0099d9 + 7fba074 commit fec8909
Copy full SHA for fec8909

File tree

Expand file treeCollapse file tree

2 files changed

+10
-8
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-8
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/EventListener/ConsoleProfilerListener.php
+9-7Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(
4343
private readonly RequestStack $requestStack,
4444
private readonly Stopwatch $stopwatch,
4545
private readonly bool $cliMode,
46-
private readonly UrlGeneratorInterface $urlGenerator,
46+
private readonly ?UrlGeneratorInterface $urlGenerator = null,
4747
) {
4848
$this->profiles = new \SplObjectStorage();
4949
$this->parents = new \SplObjectStorage();
@@ -140,12 +140,14 @@ public function profile(ConsoleTerminateEvent $event): void
140140
$p = $this->profiles[$r];
141141
$this->profiler->saveProfile($p);
142142

143-
$token = $p->getToken();
144-
$output?->writeln(sprintf(
145-
'See profile <href=%s>%s</>',
146-
$this->urlGenerator->generate('_profiler', ['token' => $token], UrlGeneratorInterface::ABSOLUTE_URL),
147-
$token
148-
));
143+
if ($this->urlGenerator && $output) {
144+
$token = $p->getToken();
145+
$output->writeln(sprintf(
146+
'See profile <href=%s>%s</>',
147+
$this->urlGenerator->generate('_profiler', ['token' => $token], UrlGeneratorInterface::ABSOLUTE_URL),
148+
$token
149+
));
150+
}
149151
}
150152

151153
$this->profiles = new \SplObjectStorage();

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/profiling.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/profiling.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
service('.virtual_request_stack'),
4545
service('debug.stopwatch'),
4646
param('kernel.runtime_mode.cli'),
47-
service('router'),
47+
service('router')->nullOnInvalid(),
4848
])
4949
->tag('kernel.event_subscriber')
5050

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.