Skip to content
This repository has been archived by the owner on Jan 17, 2022. It is now read-only.

Commit

Permalink
fix(session-storage): Reset session storage on kernel.finish_request
Browse files Browse the repository at this point in the history
  • Loading branch information
supersmile2009 authored and k911 committed Aug 13, 2020
1 parent ef0857c commit 6b7a992
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -9,10 +9,10 @@
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface;
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
use Symfony\Component\HttpKernel\Event\KernelEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\Event\TerminateEvent;
use Symfony\Component\HttpKernel\KernelEvents;

/**
Expand Down Expand Up @@ -66,9 +66,9 @@ public function onKernelResponse(ResponseEvent $event): void
$responseHeaderBag->setCookie($this->makeSessionCookie($session));
}

public function onKernelTerminate(TerminateEvent $event): void
public function onFinishRequest(FinishRequestEvent $event): void
{
if (!$this->isSessionRelated($event)) {
if (!$event->isMasterRequest() || !$this->isSessionRelated($event)) {
return;
}

Expand All @@ -84,7 +84,7 @@ public static function getSubscribedEvents(): array
return [
KernelEvents::REQUEST => ['onKernelRequest', 192],
KernelEvents::RESPONSE => ['onKernelResponse', -128],
KernelEvents::TERMINATE => ['onKernelTerminate', -128],
KernelEvents::FINISH_REQUEST => ['onFinishRequest', -128],
];
}

Expand Down

0 comments on commit 6b7a992

Please sign in to comment.