[FrameworkBundle] removed deprecated cookie options

This commit is contained in:
Fabien Potencier 2013-03-01 11:25:35 +01:00
parent b3081e85a0
commit 0bb5d01f32
12 changed files with 24 additions and 162 deletions

View File

@ -222,11 +222,6 @@ class Configuration implements ConfigurationInterface
->scalarNode('gc_probability')->end()
->scalarNode('gc_maxlifetime')->end()
->scalarNode('save_path')->defaultValue('%kernel.cache_dir%/sessions')->end()
->scalarNode('lifetime')->info('DEPRECATED! Please use: cookie_lifetime')->end()
->scalarNode('path')->info('DEPRECATED! Please use: cookie_path')->end()
->scalarNode('domain')->info('DEPRECATED! Please use: cookie_domain')->end()
->booleanNode('secure')->info('DEPRECATED! Please use: cookie_secure')->end()
->booleanNode('httponly')->info('DEPRECATED! Please use: cookie_httponly')->end()
->end()
->end()
->end()

View File

@ -308,13 +308,6 @@ class FrameworkExtension extends Extension
}
}
//we deprecated session options without cookie_ prefix, but we are still supporting them,
//Let's merge the ones that were supplied without prefix
foreach (array('lifetime', 'path', 'domain', 'secure', 'httponly') as $key) {
if (!isset($options['cookie_'.$key]) && isset($config[$key])) {
$options['cookie_'.$key] = $config[$key];
}
}
$container->setParameter('session.storage.options', $options);
// session handler (the internal callback registered with PHP session management)

View File

@ -88,11 +88,6 @@
<xsd:attribute name="cookie-secure" type="xsd:boolean" />
<xsd:attribute name="cookie-httponly" type="xsd:boolean" />
<!-- deprecated attributes -->
<xsd:attribute name="lifetime" type="xsd:string" />
<xsd:attribute name="path" type="xsd:string" />
<xsd:attribute name="domain" type="xsd:string" />
<xsd:attribute name="secure" type="xsd:boolean" />
<xsd:attribute name="httponly" type="xsd:boolean" />
<xsd:attribute name="auto-start" type="xsd:boolean" />
<!-- end of deprecated attributes -->
<xsd:attribute name="cache-limiter" type="xsd:string" />

View File

@ -1,20 +0,0 @@
<?php
$container->loadFromExtension('framework', array(
'secret' => 's3cr3t',
'session' => array(
'storage_id' => 'session.storage.native',
'handler_id' => 'session.handler.native_file',
'name' => '_SYMFONY',
'lifetime' => 2012,
'path' => '/sf2',
'domain' => 'sf2.example.com',
'secure' => false,
'httponly' => false,
'cookie_lifetime' => 86400,
'cookie_path' => '/',
'cookie_domain' => 'example.com',
'cookie_secure' => true,
'cookie_httponly' => true,
),
));

View File

@ -1,17 +0,0 @@
<?php
$container->loadFromExtension('framework', array(
'secret' => 's3cr3t',
'session' => array(
'storage_id' => 'session.storage.native',
'handler_id' => 'session.handler.native_file',
'name' => '_SYMFONY',
'lifetime' => 2012,
'path' => '/sf2',
'domain' => 'sf2.example.com',
'secure' => false,
'cookie_lifetime' => 86400,
'cookie_path' => '/',
'cookie_httponly' => true,
),
));

View File

@ -22,18 +22,18 @@ $container->loadFromExtension('framework', array(
'type' => 'xml',
),
'session' => array(
'storage_id' => 'session.storage.native',
'handler_id' => 'session.handler.native_file',
'name' => '_SYMFONY',
'lifetime' => 86400,
'path' => '/',
'domain' => 'example.com',
'secure' => true,
'httponly' => true,
'gc_maxlifetime' => 90000,
'gc_divisor' => 108,
'gc_probability' => 1,
'save_path' => '/path/to/sessions',
'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' => true,
'gc_maxlifetime' => 90000,
'gc_divisor' => 108,
'gc_probability' => 1,
'save_path' => '/path/to/sessions',
),
'templating' => array(
'assets_version' => 'SomeVersionScheme',

View File

@ -1,12 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config secret="s3cr3t">
<framework:session storage-id="session.storage.native" handler-id="session.handler.native_file" name="_SYMFONY" lifetime="2012" path="/sf2" domain="sf2.example.com" secure="false" httponly="false" cookie-lifetime="86400" cookie-path="/" cookie-domain="example.com" cookie-secure="true" cookie-httponly="true" />
</framework:config>
</container>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config secret="s3cr3t">
<framework:session storage-id="session.storage.native" handler-id="session.handler.native_file" name="_SYMFONY" lifetime="2012" path="/sf2" domain="sf2.example.com" secure="false" httponly="false" cookie-lifetime="86400" cookie-path="/" cookie-httponly="true" />
</framework:config>
</container>

View File

@ -1,16 +0,0 @@
framework:
secret: s3cr3t
session:
storage_id: session.storage.native
handler_id: session.handler.native_file
name: _SYMFONY
lifetime: 2012
path: /sf2
domain: sf2.example.com
secure: false
httponly: false
cookie_lifetime: 86400
cookie_path: /
cookie_domain: example.com
cookie_secure: true
cookie_httponly: true

View File

@ -1,14 +0,0 @@
framework:
secret: s3cr3t
session:
storage_id: session.storage.native
handler_id: session.handler.native_file
name: _SYMFONY
lifetime: 2012
path: /sf2
domain: sf2.example.com
secure: false
httponly: false
cookie_lifetime: 86400
cookie_path: /
cookie_httponly: true

View File

@ -16,18 +16,18 @@ framework:
resource: %kernel.root_dir%/config/routing.xml
type: xml
session:
storage_id: session.storage.native
handler_id: session.handler.native_file
name: _SYMFONY
lifetime: 86400
path: /
domain: example.com
secure: true
httponly: true
gc_probability: 1
gc_divisor: 108
gc_maxlifetime: 90000
save_path: /path/to/sessions
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: true
gc_probability: 1
gc_divisor: 108
gc_maxlifetime: 90000
save_path: /path/to/sessions
templating:
assets_version: SomeVersionScheme
assets_base_urls: http://cdn.example.com

View File

@ -111,36 +111,6 @@ abstract class FrameworkExtensionTest extends TestCase
$this->assertEquals('/path/to/sessions', $container->getParameter('session.save_path'));
}
public function testSessionDeprecatedMergeFull()
{
$container = $this->createContainerFromFile('deprecated_merge_full');
$this->assertTrue($container->hasDefinition('session'), '->registerSessionConfiguration() loads session.xml');
$options = $container->getParameter('session.storage.options');
$this->assertEquals('_SYMFONY', $options['name']);
$this->assertEquals(86400, $options['cookie_lifetime']);
$this->assertEquals('/', $options['cookie_path']);
$this->assertEquals('example.com', $options['cookie_domain']);
$this->assertTrue($options['cookie_secure']);
$this->assertTrue($options['cookie_httponly']);
}
public function testSessionDeprecatedMergePartial()
{
$container = $this->createContainerFromFile('deprecated_merge_partial');
$this->assertTrue($container->hasDefinition('session'), '->registerSessionConfiguration() loads session.xml');
$options = $container->getParameter('session.storage.options');
$this->assertEquals('_SYMFONY', $options['name']);
$this->assertEquals(86400, $options['cookie_lifetime']);
$this->assertEquals('/', $options['cookie_path']);
$this->assertEquals('sf2.example.com', $options['cookie_domain']);
$this->assertFalse($options['cookie_secure']);
$this->assertTrue($options['cookie_httponly']);
}
public function testTemplating()
{
$container = $this->createContainerFromFile('full');