8000 [Security] fixed a leak in the ContextListener · symfony/symfony@2fd8a7a · GitHub
[go: up one dir, main page]

Skip to content

Commit 2fd8a7a

Browse files
committed
[Security] fixed a leak in the ContextListener
1 parent abb8042 commit 2fd8a7a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class ContextListener implements ListenerInterface
3838
private $logger;
3939
private $userProviders;
4040
private $dispatcher;
41+
private $registered;
4142

4243
public function __construct(SecurityContextInterface $context, array $userProviders, $contextKey, LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null)
4344
{
@@ -65,8 +66,9 @@ public function __construct(SecurityContextInterface $context, array $userProvid
6566
*/
6667
public function handle(GetResponseEvent $event)
6768
{
68-
if (null !== $this->dispatcher && HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
69+
if (!$this->registered && null !== $this->dispatcher && HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
6970
$this->dispatcher->addListener(KernelEvents::RESPONSE, array($this, 'onKernelResponse'));
71+
$this->registered = true;
7072
}
7173

7274
$request = $event->getRequest();

0 commit comments

Comments
 (0)
0