Skip to content

Commit

Permalink
bug #24691 [HttpFoundation] Fix caching of session-enabled pages (nic…
Browse files Browse the repository at this point in the history
…olas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[HttpFoundation] Fix caching of session-enabled pages

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #24690
| License       | MIT
| Doc PR        | -

Commits
-------

572e02c [HttpFoundation] Fix caching of session-enabled pages
  • Loading branch information
Tobion committed Oct 26, 2017
2 parents e1daff4 + 572e02c commit fdac9e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Expand Up @@ -60,7 +60,8 @@ class NativeSessionStorage implements SessionStorageInterface
* ("auto_start", is not supported as it tells PHP to start a session before
* PHP starts to execute user-land code. Setting during runtime has no effect).
*
* cache_limiter, "" (use "0" to prevent headers from being sent entirely).
* cache_limiter, "private_no_expire" (use "0" to prevent headers from being sent entirely).
* cache_expire, "0"
* cookie_domain, ""
* cookie_httponly, ""
* cookie_lifetime, "0"
Expand Down Expand Up @@ -101,6 +102,7 @@ public function __construct(array $options = array(), $handler = null, MetadataB
{
$options += array(
'cache_limiter' => 'private_no_expire',
'cache_expire' => 0,
'use_cookies' => 1,
'lazy_write' => 1,
);
Expand Down Expand Up @@ -347,7 +349,7 @@ public function setOptions(array $options)
}

$validOptions = array_flip(array(
'cache_limiter', 'cookie_domain', 'cookie_httponly',
'cache_limiter', 'cache_expire', '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 @@ -15,6 +15,6 @@ $_SESSION is not empty
Array
(
[0] => Content-Type: text/plain; charset=utf-8
[1] => Cache-Control: private, max-age=10800
[1] => Cache-Control: private, max-age=0
)
shutdown

0 comments on commit fdac9e3

Please sign in to comment.