Skip to content

Commit 5b535b1

Browse files
committed
bug #33232 Fix handling for session parameters (vkhramtsov)
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 ------- b8c9e40980 Fix handling for session parameters
2 parents 45d993a + 38bc734 commit 5b535b1

File tree

5 files changed

+8
-2
lines changed

5 files changed

+8
-2
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
874874
// session storage
875875
$container->setAlias('session.storage', $config['storage_id'])->setPrivate(true);
876876
$options = ['cache_limiter' => '0'];
877-
foreach (['name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'cookie_samesite', 'use_cookies', 'gc_maxlifetime', 'gc_probability', 'gc_divisor'] as $key) {
877+
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) {
878878
if (isset($config[$key])) {
879879
$options[$key] = $config[$key];
880880
}

Tests/DependencyInjection/Fixtures/php/full.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
'gc_maxlifetime' => 90000,
3838
'gc_divisor' => 108,
3939
'gc_probability' => 1,
40+
'sid_length' => 22,
41+
'sid_bits_per_character' => 4,
4042
'save_path' => '/path/to/sessions',
4143
],
4244
'assets' => [

Tests/DependencyInjection/Fixtures/xml/full.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<framework:ssi enabled="true" />
1616
<framework:profiler only-exceptions="true" enabled="false" />
1717
<framework:router resource="%kernel.project_dir%/config/routing.xml" type="xml" />
18-
<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" />
18+
<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" />
1919
<framework:request>
2020
<framework:format name="csv">
2121
<framework:mime-type>text/csv</framework:mime-type>

Tests/DependencyInjection/Fixtures/yml/full.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ framework:
2929
gc_probability: 1
3030
gc_divisor: 108
3131
gc_maxlifetime: 90000
32+
sid_length: 22
33+
sid_bits_per_character: 4
3234
save_path: /path/to/sessions
3335
assets:
3436
version: v1

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,8 @@ public function testSession()
530530
$this->assertEquals(108, $options['gc_divisor']);
531531
$this->assertEquals(1, $options['gc_probability']);
532532
$this->assertEquals(90000, $options['gc_maxlifetime']);
533+
$this->assertEquals(22, $options['sid_length']);
534+
$this->assertEquals(4, $options['sid_bits_per_character']);
533535

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

0 commit comments

Comments
 (0)