Skip to content

Commit 967cf17

Browse files
author
Drak
committed
[HttpFoundation][FrameworkBundle] Keep save auto_start behaviour as in 2.2 and make component values consistent with FrameworkBundle's configuration options.
1 parent be6665d commit 967cf17

File tree

4 files changed

+4
-16
lines changed

4 files changed

+4
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ CHANGELOG
99
* added `TimedPhpEngine`
1010
* added `--clean` option the the `translation:update` command
1111
* added `http_method_override` option
12-
* Reintroduce `auto_start` session config flag which control to `SessionListener` to manually start sessions
13-
during framework request cycle.
12+
* Reintroduce `auto_start` session config flag to instruct the `SessionListener` to manually start session
1413
* Added session config option `on_demand_mode` to control session start on demand.
1514

1615
2.2.0

DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
185185
->canBeUnset()
186186
->children()
187187
->booleanNode('auto_start')
188-
->defaultTrue()
188+
->defaultFalse()
189189
->info('Flag for SessionListener to start session')
190190
->end()
191191
->enumNode('on_demand_mode')

DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -319,18 +319,7 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
319319
$container->setParameter('session.auto_start', $config['auto_start']);
320320

321321
// this controls the session start on demand feature
322-
switch ($config['on_demand_mode']) {
323-
// already validated
324-
case 'on':
325-
$demand = SessionStorageInterface::START_ON_DEMAND;
326-
break;
327-
case 'off':
328-
$demand = SessionStorageInterface::NO_START_ON_DEMAND_STRICT;
329-
break;
330-
case 'off_lax':
331-
$demand = SessionStorageInterface::NO_START_ON_DEMAND_LAX;
332-
}
333-
$container->setParameter('session.storage.on_demand_mode', $demand);
322+
$container->setParameter('session.storage.on_demand_mode', $config['on_demand_mode']);
334323

335324
$container->setParameter('session.storage.mock_name', $config['mock_name']);
336325

EventListener/SessionListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class SessionListener implements EventSubscriberInterface
3131
private $container;
3232
private $autoStart;
3333

34-
public function __construct(ContainerInterface $container, $autoStart)
34+
public function __construct(ContainerInterface $container, $autoStart = false)
3535
{
3636
$this->container = $container;
3737
$this->autoStart = $autoStart;

0 commit comments

Comments
 (0)