Skip to content

Commit 14527a7

Browse files
Merge branch '3.4' into 4.3
* 3.4: Fix inconsistent return points. [Security/Core] UserInterface::getPassword() can return null [Router] Fix TraceableUrlMatcher behaviour with trailing slash
2 parents 4af483f + 252ac05 commit 14527a7

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

Firewall/ExceptionListener.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,21 @@ public function onKernelException(GetResponseForExceptionEvent $event)
9292
$exception = $event->getException();
9393
do {
9494
if ($exception instanceof AuthenticationException) {
95-
return $this->handleAuthenticationException($event, $exception);
96-
} elseif ($exception instanceof AccessDeniedException) {
97-
return $this->handleAccessDeniedException($event, $exception);
98-
} elseif ($exception instanceof LogoutException) {
99-
return $this->handleLogoutException($exception);
95+
$this->handleAuthenticationException($event, $exception);
96+
97+
return;
98+
}
99+
100+
if ($exception instanceof AccessDeniedException) {
101+
$this->handleAccessDeniedException($event, $exception);
102+
103+
return;
104+
}
105+
106+
if ($exception instanceof LogoutException) {
107+
$this->handleLogoutException($exception);
108+
109+
return;
100110
}
101111
} while (null !== $exception = $exception->getPrevious());
102112
}

Firewall/UsernamePasswordJsonAuthenticationListener.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ public function __invoke(RequestEvent $event)
140140
$event->setResponse($response);
141141
}
142142

143+
/**
144+
* @return Response|null
145+
*/
143146
private function onSuccess(Request $request, TokenInterface $token)
144147
{
145148
if (null !== $this->logger) {
@@ -156,7 +159,7 @@ private function onSuccess(Request $request, TokenInterface $token)
156159
}
157160

158161
if (!$this->successHandler) {
159-
return; // let the original request succeeds
162+
return null; // let the original request succeeds
160163
}
161164

162165
$response = $this->successHandler->onAuthenticationSuccess($request, $token);

0 commit comments

Comments
 (0)