Skip to content

Commit

Permalink
merged branch tna/session-cache-limiter (PR #3400)
Browse files Browse the repository at this point in the history
Commits
-------

fb2bb65 [HttpFoundation] Fix session.cache_limiter is not set correctly

Discussion
----------

[HttpFoundation] Fix session.cache_limiter is not set correctly

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

Fixes a regression after the session refactoring where extra cache control http headers are sent.

This was previously handled by [calling session_cache_limiter(false) in NativeSessionStorage](https://github.com/symfony/symfony/blob/2.0/src/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php#L81)

---------------------------------------------------------------------------

by drak at 2012-02-21T12:23:48Z

@fabpot - this code can be merged imo.
  • Loading branch information
fabpot committed Feb 21, 2012
2 parents dc1ff89 + fb2bb65 commit 74ebd05
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Expand Up @@ -58,6 +58,7 @@ abstract class AbstractSessionStorage implements SessionStorageInterface
* but we omit 'session.' from the beginning of the keys.
*
* auto_start, "0"
* cache_limiter, ""
* cookie_domain, ""
* cookie_httponly, ""
* cookie_lifetime, "0"
Expand Down Expand Up @@ -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'])) {
Expand All @@ -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',
Expand Down
Expand Up @@ -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 74ebd05

Please sign in to comment.