Skip to content
This repository
Browse code

[FrameworkBundle] Remove 'auto_start' configuration parameter.

  • Loading branch information...
commit 1fd66f3cdf55ea63b3c1ee968cd2d0d774c9ea4e 1 parent 8ebe624
Drak authored June 29, 2012
2  src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
Source Rendered
@@ -32,3 +32,5 @@ CHANGELOG
32 32
   `gc_probability`/`gc_divisor` chance of being run. The `gc_maxlifetime` defines
33 33
    how long a session can idle for. It is different from cookie lifetime which
34 34
    declares how long a cookie can be stored on the remote client.
  35
+ * Removed 'auto_start' configuration parameter from session config. The session will
  36
+   start on demand.
2  src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -176,7 +176,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
176 176
                     ->info('session configuration')
177 177
                     ->canBeUnset()
178 178
                     ->children()
179  
-                        ->booleanNode('auto_start')->defaultFalse()->end()
  179
+                        ->booleanNode('auto_start')->info('DEPRECATED! Session wil start on demand')->end()
180 180
                         ->scalarNode('storage_id')->defaultValue('session.storage.native')->end()
181 181
                         ->scalarNode('handler_id')->defaultValue('session.handler.native_file')->end()
182 182
                         ->scalarNode('name')->end()
5  src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -291,13 +291,10 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
291 291
     {
292 292
         $loader->load('session.xml');
293 293
 
294  
-        // session
295  
-        $container->getDefinition('session_listener')->addArgument($config['auto_start']);
296  
-
297 294
         // session storage
298 295
         $container->setAlias('session.storage', $config['storage_id']);
299 296
         $options = array();
300  
-        foreach (array('name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'auto_start', 'gc_maxlifetime', 'gc_probability', 'gc_divisor') as $key) {
  297
+        foreach (array('name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'gc_maxlifetime', 'gc_probability', 'gc_divisor') as $key) {
301 298
             if (isset($config[$key])) {
302 299
                 $options[$key] = $config[$key];
303 300
             }
1  src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php
@@ -41,7 +41,6 @@ class SessionListener implements EventSubscriberInterface
41 41
     public function __construct(ContainerInterface $container, $autoStart = false)
42 42
     {
43 43
         $this->container = $container;
44  
-        $this->autoStart = $autoStart;
45 44
     }
46 45
 
47 46
     public function onKernelRequest(GetResponseEvent $event)
1  src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_full.php
@@ -3,7 +3,6 @@
3 3
 $container->loadFromExtension('framework', array(
4 4
     'secret' => 's3cr3t',
5 5
     'session' => array(
6  
-        'auto_start'        => true,
7 6
         'storage_id'        => 'session.storage.native',
8 7
         'handler_id'        => 'session.handler.native_file',
9 8
         'name'              => '_SYMFONY',
1  src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_partial.php
@@ -3,7 +3,6 @@
3 3
 $container->loadFromExtension('framework', array(
4 4
     'secret' => 's3cr3t',
5 5
     'session' => array(
6  
-        'auto_start'        => true,
7 6
         'storage_id'        => 'session.storage.native',
8 7
         'handler_id'        => 'session.handler.native_file',
9 8
         'name'              => '_SYMFONY',
1  src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php
@@ -19,7 +19,6 @@
19 19
         'type'         => 'xml',
20 20
     ),
21 21
     'session' => array(
22  
-        'auto_start'     => true,
23 22
         'storage_id'     => 'session.storage.native',
24 23
         'handler_id'     => 'session.handler.native_file',
25 24
         'name'           => '_SYMFONY',
1  src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/deprecated_merge_full.yml
... ...
@@ -1,7 +1,6 @@
1 1
 framework:
2 2
     secret: s3cr3t
3 3
     session:
4  
-        auto_start:       true
5 4
         storage_id:       session.storage.native
6 5
         handler_id:       session.handler.native_file
7 6
         name:             _SYMFONY
1  src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/deprecated_merge_partial.yml
... ...
@@ -1,7 +1,6 @@
1 1
 framework:
2 2
     secret: s3cr3t
3 3
     session:
4  
-        auto_start:       true
5 4
         storage_id:       session.storage.native
6 5
         handler_id:       session.handler.native_file
7 6
         name:             _SYMFONY
1  src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml
@@ -13,7 +13,6 @@ framework:
13 13
         resource:     %kernel.root_dir%/config/routing.xml
14 14
         type:         xml
15 15
     session:
16  
-        auto_start:     true
17 16
         storage_id:     session.storage.native
18 17
         handler_id:     session.handler.native_file
19 18
         name:           _SYMFONY
1  src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
@@ -77,7 +77,6 @@ public function testSession()
77 77
 
78 78
         $this->assertTrue($container->hasDefinition('session'), '->registerSessionConfiguration() loads session.xml');
79 79
         $this->assertEquals('fr', $container->getParameter('kernel.default_locale'));
80  
-        $this->assertTrue($container->getDefinition('session_listener')->getArgument(1));
81 80
         $this->assertEquals('session.storage.native', (string) $container->getAlias('session.storage'));
82 81
         $this->assertEquals('session.handler.native_file', (string) $container->getAlias('session.handler'));
83 82
 
1  src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/SessionHelperTest.php
@@ -25,6 +25,7 @@ protected function setUp()
25 25
         $this->request = new Request();
26 26
 
27 27
         $session = new Session(new MockArraySessionStorage());
  28
+        $session->start();
28 29
         $session->set('foobar', 'bar');
29 30
         $session->getFlashBag()->set('notice', 'bar');
30 31
 

5 notes on commit 1fd66f3

Manuel Mazzuola

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".  
                                                                                                       

Fabien Potencier
Owner

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

Christophe Coevoet
Collaborator
stof commented on 1fd66f3 July 09, 2012

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

Drak
Collaborator
drak commented on 1fd66f3 July 10, 2012

@stof - not any more. @fabpot instructed sessions to be started on demand - so any call to $session->get/set() for example will start the session.

Christophe Coevoet
Collaborator
stof commented on 1fd66f3 July 10, 2012

@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.
Something went wrong with that request. Please try again.