Skip to content

Commit 8280dad

Browse files
Throw Exception when logout handler is called
1 parent 38bcf19 commit 8280dad

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Security/Http/Logout/ContextInvalidationLogoutHandler.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpFoundation\Response;
1717
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
18+
use Symfony\Component\Security\Http\Event\LogoutEvent;
1819
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
1920

2021
/**
@@ -38,6 +39,13 @@ public function __construct(UserContextInvalidator $invalidator)
3839
public function logout(Request $request, Response $response, TokenInterface $token)
3940
{
4041
@trigger_error('Using the ContextInvalidationLogoutHandler is deprecated', E_USER_DEPRECATED);
42+
43+
if (class_exists(LogoutEvent::class)) {
44+
// This function should not longer be called in Symfony 5.1
45+
// See also: https://github.com/FriendsOfSymfony/FOSHttpCacheBundle/pull/545#discussion_r465089219
46+
throw new \LogicException(__CLASS__ . '::' . __METHOD__ . ' is deprecated and should since Symfony 5.1 not longer be called.');
47+
}
48+
4149
$this->invalidator->invalidateContext($request->getSession()->getId());
4250
}
4351
}

0 commit comments

Comments
 (0)