Skip to content

Commit

Permalink
bug #33232 Fix handling for session parameters (vkhramtsov)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.3 branch.

Discussion
----------

Fix handling for session parameters

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

Commits
-------

b8c9e40 Fix handling for session parameters
  • Loading branch information
fabpot committed Aug 19, 2019
2 parents 3aa4537 + b8c9e40 commit 3aceb6d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
Expand Up @@ -874,7 +874,7 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
// session storage
$container->setAlias('session.storage', $config['storage_id'])->setPrivate(true);
$options = ['cache_limiter' => '0'];
foreach (['name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'cookie_samesite', 'use_cookies', 'gc_maxlifetime', 'gc_probability', 'gc_divisor'] as $key) {
foreach (['name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'cookie_samesite', 'use_cookies', 'gc_maxlifetime', 'gc_probability', 'gc_divisor', 'sid_length', 'sid_bits_per_character'] as $key) {
if (isset($config[$key])) {
$options[$key] = $config[$key];
}
Expand Down
Expand Up @@ -37,6 +37,8 @@
'gc_maxlifetime' => 90000,
'gc_divisor' => 108,
'gc_probability' => 1,
'sid_length' => 22,
'sid_bits_per_character' => 4,
'save_path' => '/path/to/sessions',
],
'assets' => [
Expand Down
Expand Up @@ -15,7 +15,7 @@
<framework:ssi enabled="true" />
<framework:profiler only-exceptions="true" enabled="false" />
<framework:router resource="%kernel.project_dir%/config/routing.xml" type="xml" />
<framework:session gc-maxlifetime="90000" gc-probability="1" gc-divisor="108" storage-id="session.storage.native" handler-id="session.handler.native_file" name="_SYMFONY" cookie-lifetime="86400" cookie-path="/" cookie-domain="example.com" cookie-secure="true" cookie-httponly="false" use-cookies="true" save-path="/path/to/sessions" />
<framework:session gc-maxlifetime="90000" gc-probability="1" gc-divisor="108" storage-id="session.storage.native" handler-id="session.handler.native_file" name="_SYMFONY" cookie-lifetime="86400" cookie-path="/" cookie-domain="example.com" cookie-secure="true" cookie-httponly="false" use-cookies="true" save-path="/path/to/sessions" sid-length="22" sid-bits-per-character="4" />
<framework:request>
<framework:format name="csv">
<framework:mime-type>text/csv</framework:mime-type>
Expand Down
Expand Up @@ -29,6 +29,8 @@ framework:
gc_probability: 1
gc_divisor: 108
gc_maxlifetime: 90000
sid_length: 22
sid_bits_per_character: 4
save_path: /path/to/sessions
assets:
version: v1
Expand Down
Expand Up @@ -530,6 +530,8 @@ public function testSession()
$this->assertEquals(108, $options['gc_divisor']);
$this->assertEquals(1, $options['gc_probability']);
$this->assertEquals(90000, $options['gc_maxlifetime']);
$this->assertEquals(22, $options['sid_length']);
$this->assertEquals(4, $options['sid_bits_per_character']);

$this->assertEquals('/path/to/sessions', $container->getParameter('session.save_path'));
}
Expand Down

0 comments on commit 3aceb6d

Please sign in to comment.