File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,11 @@ public function onKernelResponse(ResponseEvent $event)
158
158
159
159
$ isSessionEmpty = $ session ->isEmpty () && empty ($ _SESSION ); // checking $_SESSION to keep compatibility with native sessions
160
160
if ($ requestSessionCookieId && $ isSessionEmpty ) {
161
+ // PHP internally sets the session cookie value to "deleted" when setcookie() is called with empty string $value argument
162
+ // which happens in \Symfony\Component\HttpFoundation\Session\Storage\Handler\AbstractSessionHandler::destroy
163
+ // when the session gets invalidated (for example on logout) so we must handle this case here too
164
+ // otherwise we would send two Set-Cookie headers back with the response
165
+ SessionUtils::popSessionCookie ($ sessionName , 'deleted ' );
161
166
$ response ->headers ->clearCookie (
162
167
$ sessionName ,
163
168
$ sessionCookiePath ,
You can’t perform that action at this time.
0 commit comments