Skip to content

Commit 690b40c

Browse files
committed
Deprecate LogoutListener being returned as 3rd element by FirewallMapInterface::getListeners
1 parent ff70bd1 commit 690b40c

File tree

5 files changed

+14
-1
lines changed

5 files changed

+14
-1
lines changed

src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ public function __construct(ContainerInterface $container, iterable $map)
3535

3636
public function getListeners(Request $request)
3737
{
38+
if (2 > \func_num_args() || func_get_arg(1)) {
39+
trigger_deprecation('symfony/security-bundle', '5.4', 'The third element in the return value of "%s()" is deprecated', __METHOD__);
40+
}
41+
3842
$context = $this->getFirewallContext($request);
3943

4044
if (null === $context) {

src/Symfony/Component/Security/Http/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ CHANGELOG
1616
* Deprecate `CookieClearingLogoutHandler`, `SessionLogoutHandler` and `CsrfTokenClearingLogoutHandler`.
1717
Use `CookieClearingLogoutListener`, `SessionLogoutListener` and `CsrfTokenClearingLogoutListener` instead
1818
* Deprecate `PassportInterface`, `UserPassportInterface` and `PassportTrait`, use `Passport` instead
19+
* Deprecate the third element of the outer array returned by `FirewallMapInterface::getListener` which contains the `LogoutListener`.
1920

2021
5.3
2122
---

src/Symfony/Component/Security/Http/Firewall.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function onKernelRequest(RequestEvent $event)
4848
}
4949

5050
// register listeners for this firewall
51-
$listeners = $this->map->getListeners($event->getRequest());
51+
$listeners = $this->map->getListeners($event->getRequest(), false);
5252

5353
$authenticationListeners = $listeners[0];
5454
$exceptionListener = $listeners[1];

src/Symfony/Component/Security/Http/FirewallMap.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ public function add(RequestMatcherInterface $requestMatcher = null, array $liste
3636
*/
3737
public function getListeners(Request $request)
3838
{
39+
if (2 > \func_num_args() || func_get_arg(1)) {
40+
trigger_deprecation('symfony/security', '5.4', 'The third element in the return value of "%s()" is deprecated', __METHOD__);
41+
}
42+
3943
foreach ($this->map as $elements) {
4044
if (null === $elements[0] || $elements[0]->matches($request)) {
4145
return [$elements[1], $elements[2], $elements[3]];

src/Symfony/Component/Security/Http/FirewallMapInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ interface FirewallMapInterface
3333
* If there is no logout listener, the third element of the outer array
3434
* must be null.
3535
*
36+
* The third element of the outer array is deprecated since Symfony 5.4. It
37+
* will be removed in Symfony 6.0 and instead the LogoutListener will be
38+
* included in the first element.
39+
*
3640
* @return array of the format [[AuthenticationListener], ExceptionListener, LogoutListener]
3741
*/
3842
public function getListeners(Request $request);

0 commit comments

Comments
 (0)