Skip to content

Commit

Permalink
[FrameworkBundle] Fix passing request_stack to session.listener
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Oct 4, 2024
1 parent f628a5a commit b1a24f4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion DependencyInjection/FrameworkExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,6 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
$locator = $container->getDefinition('session_listener')->getArgument(0);
$locator->setValues($locator->getValues() + [
'session_storage' => new Reference('session.storage', ContainerInterface::IGNORE_ON_INVALID_REFERENCE),
'request_stack' => new Reference('request_stack'),
]);
} else {
$container->getDefinition('session.storage.factory.native')->replaceArgument(3, true);
Expand Down
1 change: 1 addition & 0 deletions Resources/config/session.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'initialized_session' => service('.session.do-not-use')->ignoreOnUninitialized(),
'logger' => service('logger')->ignoreOnInvalid(),
'session_collector' => service('data_collector.request.session_collector')->ignoreOnInvalid(),
'request_stack' => service('request_stack')->ignoreOnInvalid(),
]),
param('kernel.debug'),
param('session.storage.options'),
Expand Down
8 changes: 4 additions & 4 deletions Tests/DependencyInjection/FrameworkExtensionTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ public function testNullSessionHandler()
$this->assertNull($container->getParameter('session.save_path'));
$this->assertSame('session.handler.native', (string) $container->getAlias('session.handler'));

$expected = ['session_factory', 'session', 'initialized_session', 'logger', 'session_collector'];
$expected = ['session_factory', 'session', 'initialized_session', 'logger', 'session_collector', 'request_stack'];
$this->assertEquals($expected, array_keys($container->getDefinition('session_listener')->getArgument(0)->getValues()));
$this->assertFalse($container->getDefinition('session.storage.factory.native')->getArgument(3));
}
Expand All @@ -670,7 +670,7 @@ public function testNullSessionHandlerLegacy()
$this->assertNull($container->getParameter('session.save_path'));
$this->assertSame('session.handler.native', (string) $container->getAlias('session.handler'));

$expected = ['session_factory', 'session', 'initialized_session', 'logger', 'session_collector'];
$expected = ['session_factory', 'session', 'initialized_session', 'logger', 'session_collector', 'request_stack'];
$this->assertEquals($expected, array_keys($container->getDefinition('session_listener')->getArgument(0)->getValues()));
$this->assertFalse($container->getDefinition('session.storage.factory.native')->getArgument(3));
}
Expand Down Expand Up @@ -1801,7 +1801,7 @@ public function testSessionCookieSecureAuto()
{
$container = $this->createContainerFromFile('session_cookie_secure_auto');

$expected = ['session_factory', 'session', 'initialized_session', 'logger', 'session_collector'];
$expected = ['session_factory', 'session', 'initialized_session', 'logger', 'session_collector', 'request_stack'];
$this->assertEquals($expected, array_keys($container->getDefinition('session_listener')->getArgument(0)->getValues()));
}

Expand All @@ -1814,7 +1814,7 @@ public function testSessionCookieSecureAutoLegacy()

$container = $this->createContainerFromFile('session_cookie_secure_auto_legacy');

$expected = ['session_factory', 'session', 'initialized_session', 'logger', 'session_collector', 'session_storage', 'request_stack'];
$expected = ['session_factory', 'session', 'initialized_session', 'logger', 'session_collector', 'request_stack', 'session_storage'];
$this->assertEquals($expected, array_keys($container->getDefinition('session_listener')->getArgument(0)->getValues()));
}

Expand Down

0 comments on commit b1a24f4

Please sign in to comment.