10000 feature #15123 [2.8][FrameworkBundle] Allow parameter use_cookies in … · symfony/symfony@839e925 · GitHub
[go: up one dir, main page]

Skip to content

Commit 839e925

Browse files
committed
feature #15123 [2.8][FrameworkBundle] Allow parameter use_cookies in session configuration (derrabus)
This PR was merged into the 2.8 branch. Discussion ---------- [2.8][FrameworkBundle] Allow parameter use_cookies in session configuration | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #13668 | License | MIT | Doc PR | none This PR adds support for the `use_cookies` parameter to the session configuration of Symfony's FrameworkBundle. It is a rebase of #13671 against the 2.8 branch. Commits ------- 08bf50a Allow parameter use_cookies in session configuration.
2 parents f02a5dc + 08bf50a commit 839e925

File tree

7 files changed

+7
-2
lines changed

7 files changed

+7
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
341341
->scalarNode('cookie_domain')->end()
342342
->booleanNode('cookie_secure')->end()
343343
->booleanNode('cookie_httponly')->defaultTrue()->end()
344+
->booleanNode('use_cookies')->end()
344345
->scalarNode('gc_divisor')->end()
345346
->scalarNode('gc_probability')->defaultValue(1)->end()
346347
->scalarNode('gc_maxlifetime')->end()

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
396396
// session storage
397397
$container->setAlias('session.storage', $config['storage_id']);
398398
$options = array();
399-
foreach (array('name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'gc_maxlifetime', 'gc_probability', 'gc_divisor') as $key) {
399+
foreach (array('name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'use_cookies', 'gc_maxlifetime', 'gc_probability', 'gc_divisor') as $key) {
400400
if (isset($config[$key])) {
401401
$options[$key] = $config[$key];
402402
}

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
<xsd:attribute name="cookie-domain" type="xsd:string" />
108108
<xsd:attribute name="cookie-secure" type="xsd:boolean" />
109109
<xsd:attribute name="cookie-httponly" type="xsd:boolean" />
110+
<xsd:attribute name="use-cookies" type="xsd:boolean" />
110111
<xsd:attribute name="cache-limiter" type="xsd:string" />
111112
<xsd:attribute name="gc-maxlifetime" type="xsd:string" />
112113
<xsd:attribute name="gc-divisor" type="xsd:string" />

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
'cookie_domain' => 'example.com',
3434
'cookie_secure' => true,
3535
'cookie_httponly' => false,
36+
'use_cookies' => true,
3637
'gc_maxlifetime' => 90000,
3738
'gc_divisor' => 108,
3839
'gc_probability' => 1,

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<framework:esi enabled="true" />
1515
<framework:profiler only-exceptions="true" enabled="false" />
1616
<framework:router resource="%kernel.root_dir%/config/routing.xml" type="xml" />
17-
<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" save-path="/path/to/sessions" />
17+
<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" />
1818
<framework:request>
1919
<framework:format name="csv">
2020
<framework:mime-type>text/csv</framework:mime-type>

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ framework:
2525
cookie_domain: example.com
2626
cookie_secure: true
2727
cookie_httponly: false
28+
use_cookies: true
2829
gc_probability: 1
2930
gc_divisor: 108
3031
gc_maxlifetime: 90000

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ public function testSession()
150150
$this->assertEquals('example.com', $options['cookie_domain']);
151< 57AE /code>151
$this->assertTrue($options['cookie_secure']);
152152
$this->assertFalse($options['cookie_httponly']);
153+
$this->assertTrue($options['use_cookies']);
153154
$this->assertEquals(108, $options['gc_divisor']);
154155
$this->assertEquals(1, $options['gc_probability']);
155156
$this->assertEquals(90000, $options['gc_maxlifetime']);

0 commit comments

Comments
 (0)
0