diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
index 5195ff1c2f..6738eb3e4a 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -167,7 +167,7 @@ class Configuration implements ConfigurationInterface
->canBeUnset()
->children()
->booleanNode('auto_start')->defaultFalse()->end()
- ->scalarNode('storage_id')->defaultValue('session.storage.native')->end()
+ ->scalarNode('storage_id')->defaultValue('session.storage.native_file')->end()
->scalarNode('name')->end()
->scalarNode('lifetime')->end()
->scalarNode('path')->end()
diff --git a/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php b/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php
index 7d6ac49a06..d335758b70 100644
--- a/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php
+++ b/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php
@@ -69,7 +69,6 @@ class TestSessionListener implements EventSubscriberInterface
if ($session = $event->getRequest()->getSession()) {
$session->save();
- $session->close();
$params = session_get_cookie_params();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml
index c3c2eba0c5..a1a746b781 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml
@@ -6,8 +6,19 @@
Symfony\Component\HttpFoundation\Session
- Symfony\Component\HttpFoundation\SessionStorage\NativeSessionStorage
- Symfony\Component\HttpFoundation\SessionStorage\FilesystemSessionStorage
+ Symfony\Component\HttpFoundation\FlashBag
+ Symfony\Component\HttpFoundation\AttributeBag
+ Symfony\Component\HttpFoundation\SessionStorage\NativeFileSessionStorage
+ Symfony\Component\HttpFoundation\SessionStorage\NullSessionStorage
+ Symfony\Component\HttpFoundation\SessionStorage\NativeMemcacheSessionStorage
+ Symfony\Component\HttpFoundation\SessionStorage\NativeMemcachedSessionStorage
+ Symfony\Component\HttpFoundation\SessionStorage\NativeSqliteSessionStorage
+ Symfony\Component\HttpFoundation\SessionStorage\MemcacheSessionStorage
+ Symfony\Component\HttpFoundation\SessionStorage\MemcachedSessionStorage
+ Symfony\Component\HttpFoundation\SessionStorage\MockFileSessionStorage
+ Memcache
+ Memcached
+
Symfony\Bundle\FrameworkBundle\EventListener\SessionListener
@@ -16,13 +27,66 @@
-
- %session.storage.options%
-
+
+
+
+
-
+
%kernel.cache_dir%/sessions
%session.storage.options%
+
+
+
+
+
+ %kernel.cache_dir%/sessions
+ %session.storage.options%
+
+
+
+
+
+ tcp://127.0.0.1:11211?persistent=0
+ %session.storage.options%
+
+
+
+
+
+ 127.0.0.1:11211
+ %session.storage.options%
+
+
+
+
+
+
+ tcp://127.0.0.1:11211?persistent=0
+ %session.storage.options%
+
+
+
+
+
+
+ tcp://127.0.0.1:11211?persistent=0
+ %session.storage.options%
+
+
+
+
+
+ %kernel.cache_dir%/sf2_sqlite_sess.db
+ %session.storage.options%
+
+
+
+
+
+ %session.storage.options%
+
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/SessionHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/SessionHelper.php
index 041d9ddff9..a60b14997f 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/SessionHelper.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/SessionHelper.php
@@ -13,6 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\Templating\Helper;
use Symfony\Component\Templating\Helper\Helper;
use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\FlashBagInterface;
/**
* SessionHelper provides read-only access to the session attributes.
@@ -46,19 +47,19 @@ class SessionHelper extends Helper
return $this->session->get($name, $default);
}
- public function getFlash($name, $default = null)
+ public function getFlashes($type)
{
- return $this->session->getFlash($name, $default);
+ return $this->session->getFlashes($type);
}
- public function getFlashes()
+ public function getAllFlashes()
{
- return $this->session->getFlashes();
+ return $this->session->getAllFlashes();
}
- public function hasFlash($name)
+ public function hasFlashes($type)
{
- return $this->session->hasFlash($name);
+ return $this->session->hasFlashes($type);
}
/**
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php
index 01361f2280..3ab6488493 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php
@@ -20,7 +20,7 @@ $container->loadFromExtension('framework', array(
),
'session' => array(
'auto_start' => true,
- 'storage_id' => 'session.storage.native',
+ 'storage_id' => 'session.storage.native_file',
'name' => '_SYMFONY',
'lifetime' => 86400,
'path' => '/',
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml
index 2d6a06047e..e46a476a96 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml
@@ -12,7 +12,7 @@
-
+
loader.foo
loader.bar
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml
index 3c7db0ee49..126baf2d4e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml
@@ -14,7 +14,7 @@ framework:
type: xml
session:
auto_start: true
- storage_id: session.storage.native
+ storage_id: session.storage.native_file
name: _SYMFONY
lifetime: 86400
path: /
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
index 3da5483944..6aa952e3a6 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
@@ -78,7 +78,7 @@ abstract class FrameworkExtensionTest extends TestCase
$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.storage.native_file', (string) $container->getAlias('session.storage'));
$options = $container->getParameter('session.storage.options');
$this->assertEquals('_SYMFONY', $options['name']);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php
index e77f1f1266..f1e30fd001 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php
@@ -51,7 +51,7 @@ class SessionController extends ContainerAware
{
$request = $this->container->get('request');
$session = $request->getSession();
- $session->setFlash('notice', $message);
+ $session->addFlash($message, 'notice');
return new RedirectResponse($this->container->get('router')->generate('session_showflash'));
}
@@ -61,8 +61,8 @@ class SessionController extends ContainerAware
$request = $this->container->get('request');
$session = $request->getSession();
- if ($session->hasFlash('notice')) {
- $output = $session->getFlash('notice');
+ if ($session->hasFlashes('notice')) {
+ list($output) = $session->popFlashes('notice');
} else {
$output = 'No flash was set.';
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/config/framework.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/config/framework.yml
index 18ed6f4d87..0cc6b74d30 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/config/framework.yml
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/config/framework.yml
@@ -10,7 +10,7 @@ framework:
default_locale: en
session:
auto_start: true
- storage_id: session.storage.filesystem
+ storage_id: session.storage.mock_file
services:
logger: { class: Symfony\Component\HttpKernel\Log\NullLogger }
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/SessionHelperTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/SessionHelperTest.php
index ee400cd7dc..e7e7b4a764 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/SessionHelperTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/SessionHelperTest.php
@@ -15,6 +15,8 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session;
use Symfony\Component\HttpFoundation\SessionStorage\ArraySessionStorage;
use Symfony\Bundle\FrameworkBundle\Templating\Helper\SessionHelper;
+use Symfony\Component\HttpFoundation\FlashBag;
+use Symfony\Component\HttpFoundation\AttributeBag;
class SessionHelperTest extends \PHPUnit_Framework_TestCase
{
@@ -24,9 +26,9 @@ class SessionHelperTest extends \PHPUnit_Framework_TestCase
{
$this->request = new Request();
- $session = new Session(new ArraySessionStorage());
+ $session = new Session(new ArraySessionStorage(new AttributeBag(), new FlashBag()));
$session->set('foobar', 'bar');
- $session->setFlash('foo', 'bar');
+ $session->addFlash('bar', FlashBag::NOTICE);
$this->request->setSession($session);
}
@@ -40,14 +42,11 @@ class SessionHelperTest extends \PHPUnit_Framework_TestCase
{
$helper = new SessionHelper($this->request);
- $this->assertTrue($helper->hasFlash('foo'));
+ $this->assertTrue($helper->hasFlashes(FlashBag::NOTICE));
- $this->assertEquals('bar', $helper->getFlash('foo'));
- $this->assertEquals('foo', $helper->getFlash('bar', 'foo'));
+ $this->assertEquals(array('bar'), $helper->getFlashes(FlashBag::NOTICE));
- $this->assertNull($helper->getFlash('foobar'));
-
- $this->assertEquals(array('foo' => 'bar'), $helper->getFlashes());
+ $this->assertEquals(array(FlashBag::NOTICE => array('bar')), $helper->getAllFlashes());
}
public function testGet()
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/PhpEngineTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/PhpEngineTest.php
index cefc38b0ef..4da48ea6d8 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/PhpEngineTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/PhpEngineTest.php
@@ -19,6 +19,8 @@ use Symfony\Component\HttpFoundation\SessionStorage\ArraySessionStorage;
use Symfony\Component\Templating\TemplateNameParser;
use Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
+use Symfony\Component\HttpFoundation\FlashBag;
+use Symfony\Component\HttpFoundation\AttributeBag;
class PhpEngineTest extends TestCase
{
@@ -64,7 +66,7 @@ class PhpEngineTest extends TestCase
{
$container = new Container();
$request = new Request();
- $session = new Session(new ArraySessionStorage());
+ $session = new Session(new ArraySessionStorage(new AttributeBag(), new FlashBag()));
$request->setSession($session);
$container->set('request', $request);