[HttpFoundation] Fix session.cache_limiter is not set correctly
This commit is contained in:
parent
3236fc5af3
commit
fb2bb65b1e
@ -58,6 +58,7 @@ abstract class AbstractSessionStorage implements SessionStorageInterface
|
|||||||
* but we omit 'session.' from the beginning of the keys.
|
* but we omit 'session.' from the beginning of the keys.
|
||||||
*
|
*
|
||||||
* auto_start, "0"
|
* auto_start, "0"
|
||||||
|
* cache_limiter, ""
|
||||||
* cookie_domain, ""
|
* cookie_domain, ""
|
||||||
* cookie_httponly, ""
|
* cookie_httponly, ""
|
||||||
* cookie_lifetime, "0"
|
* cookie_lifetime, "0"
|
||||||
@ -216,7 +217,7 @@ abstract class AbstractSessionStorage implements SessionStorageInterface
|
|||||||
// Unless session.cache_limiter has been set explicitly, disable it
|
// Unless session.cache_limiter has been set explicitly, disable it
|
||||||
// because this is managed by HeaderBag directly (if used).
|
// because this is managed by HeaderBag directly (if used).
|
||||||
if (!isset($this->options['cache_limiter'])) {
|
if (!isset($this->options['cache_limiter'])) {
|
||||||
$this->options['cache_limiter'] = 0;
|
$this->options['cache_limiter'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($this->options['auto_start'])) {
|
if (!isset($this->options['auto_start'])) {
|
||||||
@ -229,7 +230,7 @@ abstract class AbstractSessionStorage implements SessionStorageInterface
|
|||||||
|
|
||||||
foreach ($this->options as $key => $value) {
|
foreach ($this->options as $key => $value) {
|
||||||
if (in_array($key, array(
|
if (in_array($key, array(
|
||||||
'auto_start', 'cookie_domain', 'cookie_httponly',
|
'auto_start', 'cache_limiter', 'cookie_domain', 'cookie_httponly',
|
||||||
'cookie_lifetime', 'cookie_path', 'cookie_secure',
|
'cookie_lifetime', 'cookie_path', 'cookie_secure',
|
||||||
'entropy_file', 'entropy_length', 'gc_divisor',
|
'entropy_file', 'entropy_length', 'gc_divisor',
|
||||||
'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character',
|
'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character',
|
||||||
|
@ -124,4 +124,20 @@ class AbstractSessionStorageTest extends \PHPUnit_Framework_TestCase
|
|||||||
$storage = new ConcreteSessionStorage();
|
$storage = new ConcreteSessionStorage();
|
||||||
$this->assertNotEquals('user', ini_get('session.save_handler'));
|
$this->assertNotEquals('user', ini_get('session.save_handler'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testDefaultSessionCacheLimiter()
|
||||||
|
{
|
||||||
|
ini_set('session.cache_limiter', 'nocache');
|
||||||
|
|
||||||
|
$storage = new ConcreteSessionStorage();
|
||||||
|
$this->assertEquals('', ini_get('session.cache_limiter'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testExplicitSessionCacheLimiter()
|
||||||
|
{
|
||||||
|
ini_set('session.cache_limiter', 'nocache');
|
||||||
|
|
||||||
|
$storage = new ConcreteSessionStorage(array('cache_limiter' => 'public'));
|
||||||
|
$this->assertEquals('public', ini_get('session.cache_limiter'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user