Skip to content

Commit 41e7666

Browse files
authored
Throw LogicException instead of Error when trying to generate logout-URL without request
1 parent edb73e1 commit 41e7666

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Logout/LogoutUrlGenerator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ private function generateLogoutUrl(?string $key, int $referenceType): string
107107

108108
$request = $this->requestStack->getCurrentRequest();
109109

110+
if (!$request) {
111+
throw new \LogicException('Unable to generate the logout URL without a Request.');
112+
}
113+
110114
$url = UrlGeneratorInterface::ABSOLUTE_URL === $referenceType ? $request->getUriForPath($logoutPath) : $request->getBaseUrl().$logoutPath;
111115

112116
if (!empty($parameters)) {

0 commit comments

Comments
 (0)