Skip to content
Snippets Groups Projects
Commit 2d7ecf0d authored by Kul Pratap Singh's avatar Kul Pratap Singh Committed by Lio Novelli
Browse files

Issue #3488658 by kul.pratap, useernamee: phpstan pipeline is failing

parent 1c845929
No related branches found
No related tags found
1 merge request!111Issue #3488658: Fix redirect URL initialization and ensure proper response handling.
Pipeline #353012 passed
......@@ -80,6 +80,7 @@ class FrontendRedirectSubscriber implements EventSubscriberInterface {
if (in_array($this->getCurrentRouteMatch()->getRouteName(), $this->frontendRoutes)
&& ($event->getRequest()->getMethod()) != 'POST') {
$route_match = $this->getCurrentRouteMatch();
$redirect_url = NULL;
// For entity routes, get entity-specific frontend base URLs.
if (preg_match('/entity\.[a-z]+\.canonical/', $route_match->getRouteName())) {
$parameters = $route_match->getParameters()->all();
......@@ -101,16 +102,19 @@ class FrontendRedirectSubscriber implements EventSubscriberInterface {
}
}
// Prevent Core's RedirectResponseSubscriber from redirecting back to the
// original request's destination, ignoring our response.
$request_query_parameters = $this->requestStack->getCurrentRequest()->query;
$destination = $request_query_parameters->get('destination');
if ($destination) {
$request_query_parameters->remove('destination');
}
if (isset($redirect_url)) {
// Prevent Core's RedirectResponseSubscriber from redirecting back
// to the original request's destination, ignoring our response.
$request_query_parameters = $this->requestStack->getCurrentRequest()->query;
$destination = $request_query_parameters->get('destination');
if ($destination) {
$request_query_parameters->remove('destination');
}
$event->setResponse(new TrustedRedirectResponse($redirect_url));
$event->stopPropagation();
// Set the redirect response.
$event->setResponse(new TrustedRedirectResponse($redirect_url));
$event->stopPropagation();
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment