Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitd5a5363

Browse files
committed
Fix interception of non-conventional redirects
1 parent273fa3f commitd5a5363

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,20 @@ public function onKernelResponse(ResponseEvent $event): void
9999
return;
100100
}
101101

102+
$location =$response->headers->get('Location');
103+
102104
if ($response->headers->has('X-Debug-Token') &&$response->isRedirect() &&$this->interceptRedirects &&'html' ===$request->getRequestFormat()) {
103105
if ($request->hasSession() && ($session =$request->getSession())->isStarted() &&$session->getFlashBag()instanceof AutoExpireFlashBag) {
104106
// keep current flashes for one more request if using AutoExpireFlashBag
105107
$session->getFlashBag()->setAll($session->getFlashBag()->peekAll());
106108
}
107109

108-
$response->setContent($this->twig->render('@WebProfiler/Profiler/toolbar_redirect.html.twig', ['location' =>$response->headers->get('Location'),'host' =>$request->getSchemeAndHttpHost()]));
110+
// if there is no location, then we can't show it to the user
111+
if (!$location) {
112+
return;
113+
}
114+
115+
$response->setContent($this->twig->render('@WebProfiler/Profiler/toolbar_redirect.html.twig', ['location' =>$location,'host' =>$request->getSchemeAndHttpHost()]));
109116
$response->setStatusCode(200);
110117
$response->headers->remove('Location');
111118
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp