Permalink
Browse files

[HttpFoundation] Fix session.cache_limiter is not set correctly

  • Loading branch information...
1 parent 3236fc5 commit fb2bb65b1e7857723cc0b146413bdc0b98987262 @tna committed Feb 19, 2012
@@ -58,6 +58,7 @@
* but we omit 'session.' from the beginning of the keys.
*
* auto_start, "0"
+ * cache_limiter, ""
* cookie_domain, ""
* cookie_httponly, ""
* cookie_lifetime, "0"
@@ -216,7 +217,7 @@ protected function setOptions(array $options)
// Unless session.cache_limiter has been set explicitly, disable it
// because this is managed by HeaderBag directly (if used).
if (!isset($this->options['cache_limiter'])) {
- $this->options['cache_limiter'] = 0;
+ $this->options['cache_limiter'] = false;
}
if (!isset($this->options['auto_start'])) {
@@ -229,7 +230,7 @@ protected function setOptions(array $options)
foreach ($this->options as $key => $value) {
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',
'entropy_file', 'entropy_length', 'gc_divisor',
'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character',
@@ -124,4 +124,20 @@ public function testNativeSaveHandlers()
$storage = new ConcreteSessionStorage();
$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'));
+ }
}

0 comments on commit fb2bb65

Please sign in to comment.