@@ -29,7 +29,10 @@ class LogoutUrlGenerator
2929 private $ router ;
3030 private $ tokenStorage ;
3131 private $ listeners = [];
32- private $ currentFirewall ;
32+ /** @var string|null */
33+ private $ currentFirewallName ;
34+ /** @var string|null */
35+ private $ currentFirewallContext ;
3336
3437 public function __construct (RequestStack $ requestStack = null , UrlGeneratorInterface $ router = null , TokenStorageInterface $ tokenStorage = null )
3538 {
@@ -74,7 +77,8 @@ public function getLogoutUrl(string $key = null)
7477
7578 public function setCurrentFirewall (?string $ key , string $ context = null )
7679 {
77- $ this ->currentFirewall = [$ key , $ context ];
80+ $ this ->currentFirewallName = $ key ;
81+ $ this ->currentFirewallContext = $ context ;
7882 }
7983
8084 /**
@@ -130,7 +134,7 @@ private function getListener(?string $key): array
130134 if (null !== $ this ->tokenStorage ) {
131135 $ token = $ this ->tokenStorage ->getToken ();
132136
133- // @deprecated since 5.4
137+ // @deprecated since Symfony 5.4
134138 if ($ token instanceof AnonymousToken) {
135139 throw new \InvalidArgumentException ('Unable to generate a logout url for an anonymous token. ' );
136140 }
@@ -151,14 +155,12 @@ private function getListener(?string $key): array
151155 }
152156
153157 // Fetch from injected current firewall information, if possible
154- [$ key , $ context ] = $ this ->currentFirewall ;
155-
156- if (isset ($ this ->listeners [$ key ])) {
157- return $ this ->listeners [$ key ];
158+ if (isset ($ this ->listeners [$ this ->currentFirewallName ])) {
159+ return $ this ->listeners [$ this ->currentFirewallName ];
158160 }
159161
160162 foreach ($ this ->listeners as $ listener ) {
161- if (isset ($ listener [4 ]) && $ context === $ listener [4 ]) {
163+ if (isset ($ listener [4 ]) && $ this -> currentFirewallContext === $ listener [4 ]) {
162164 return $ listener ;
163165 }
164166 }
0 commit comments