Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FrameworkBundle] Remove 'auto_start' configuration parameter.
  • Loading branch information
Drak committed Jun 29, 2012
1 parent 8ebe624 commit 1fd66f3
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 13 deletions.
2 changes: 2 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
Expand Up @@ -32,3 +32,5 @@ CHANGELOG
`gc_probability`/`gc_divisor` chance of being run. The `gc_maxlifetime` defines
how long a session can idle for. It is different from cookie lifetime which
declares how long a cookie can be stored on the remote client.
* Removed 'auto_start' configuration parameter from session config. The session will
start on demand.
Expand Up @@ -176,7 +176,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
->info('session configuration')
->canBeUnset()
->children()
->booleanNode('auto_start')->defaultFalse()->end()
->booleanNode('auto_start')->info('DEPRECATED! Session wil start on demand')->end()
->scalarNode('storage_id')->defaultValue('session.storage.native')->end()
->scalarNode('handler_id')->defaultValue('session.handler.native_file')->end()
->scalarNode('name')->end()
Expand Down
Expand Up @@ -291,13 +291,10 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
{
$loader->load('session.xml');

// session
$container->getDefinition('session_listener')->addArgument($config['auto_start']);

// session storage
$container->setAlias('session.storage', $config['storage_id']);
$options = array();
foreach (array('name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'auto_start', 'gc_maxlifetime', 'gc_probability', 'gc_divisor') as $key) {
foreach (array('name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'gc_maxlifetime', 'gc_probability', 'gc_divisor') as $key) {
if (isset($config[$key])) {
$options[$key] = $config[$key];
}
Expand Down
Expand Up @@ -41,7 +41,6 @@ class SessionListener implements EventSubscriberInterface
public function __construct(ContainerInterface $container, $autoStart = false)
{
$this->container = $container;
$this->autoStart = $autoStart;
}

public function onKernelRequest(GetResponseEvent $event)
Expand Down
Expand Up @@ -3,7 +3,6 @@
$container->loadFromExtension('framework', array(
'secret' => 's3cr3t',
'session' => array(
'auto_start' => true,
'storage_id' => 'session.storage.native',
'handler_id' => 'session.handler.native_file',
'name' => '_SYMFONY',
Expand Down
Expand Up @@ -3,7 +3,6 @@
$container->loadFromExtension('framework', array(
'secret' => 's3cr3t',
'session' => array(
'auto_start' => true,
'storage_id' => 'session.storage.native',
'handler_id' => 'session.handler.native_file',
'name' => '_SYMFONY',
Expand Down
Expand Up @@ -19,7 +19,6 @@
'type' => 'xml',
),
'session' => array(
'auto_start' => true,
'storage_id' => 'session.storage.native',
'handler_id' => 'session.handler.native_file',
'name' => '_SYMFONY',
Expand Down
@@ -1,7 +1,6 @@
framework:
secret: s3cr3t
session:
auto_start: true
storage_id: session.storage.native
handler_id: session.handler.native_file
name: _SYMFONY
Expand Down
@@ -1,7 +1,6 @@
framework:
secret: s3cr3t
session:
auto_start: true
storage_id: session.storage.native
handler_id: session.handler.native_file
name: _SYMFONY
Expand Down
Expand Up @@ -13,7 +13,6 @@ framework:
resource: %kernel.root_dir%/config/routing.xml
type: xml
session:
auto_start: true
storage_id: session.storage.native
handler_id: session.handler.native_file
name: _SYMFONY
Expand Down
Expand Up @@ -77,7 +77,6 @@ public function testSession()

$this->assertTrue($container->hasDefinition('session'), '->registerSessionConfiguration() loads session.xml');
$this->assertEquals('fr', $container->getParameter('kernel.default_locale'));
$this->assertTrue($container->getDefinition('session_listener')->getArgument(1));
$this->assertEquals('session.storage.native', (string) $container->getAlias('session.storage'));
$this->assertEquals('session.handler.native_file', (string) $container->getAlias('session.handler'));

Expand Down
Expand Up @@ -25,6 +25,7 @@ protected function setUp()
$this->request = new Request();

$session = new Session(new MockArraySessionStorage());
$session->start();
$session->set('foobar', 'bar');
$session->getFlashBag()->set('notice', 'bar');

Expand Down

4 comments on commit 1fd66f3

@manuelmazzuola
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That commit break the flash_message_listener service

$php app/console cache:clear
                                                                                                       
  [Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]                           
  The service "fos_rest.flash_message_listener" has a dependency on a non-existent service "session".  
                                                                                                       

@fabpot
Copy link
Member

@fabpot fabpot commented on 1fd66f3 Jul 9, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@manuelmazzuola You must report this issue on the fos_rest repository as it must be fixed there.

@stof
Copy link
Member

@stof stof commented on 1fd66f3 Jul 9, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@manuelmazzuola if you remove the session key itself from your app, it means that you are disabling the session entirely in your app.

@stof
Copy link
Member

@stof stof commented on 1fd66f3 Jul 10, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Drak You still have to define session: ~ in your config. Otherwise, you simply don't have the service definition for the session (just like removing csrf_protection: true removes the CSRF provider, and removing the router section removes the router)

Please sign in to comment.