Skip to content

Commit

Permalink
Fix Uncaught PHP Exception TypeError
Browse files Browse the repository at this point in the history
Argument #2 ($user) must be of type Symfony\Component\Security\Core\User\UserInterface|string, null given
  • Loading branch information
MarcHagen committed Feb 12, 2024
1 parent 7879310 commit 82c0d28
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/EventListener/AuditLoginListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ public function onLoginFailure(LoginFailureEvent $event): void
}

try {
$username = $event->getPassport()?->getUser()->getUserIdentifier();
} catch (\Throwable $e) {
if(!$username = $event->getPassport()?->getUser()->getUserIdentifier()) {
return;
}
} catch (\Throwable) {
return;
}

Expand Down

0 comments on commit 82c0d28

Please sign in to comment.