Skip to content

Commit 572e02c

Browse files
[HttpFoundation] Fix caching of session-enabled pages
1 parent ed8c731 commit 572e02c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ class NativeSessionStorage implements SessionStorageInterface
6060
* ("auto_start", is not supported as it tells PHP to start a session before
6161
* PHP starts to execute user-land code. Setting during runtime has no effect).
6262
*
63-
* cache_limiter, "" (use "0" to prevent headers from being sent entirely).
63+
* cache_limiter, "private_no_expire" (use "0" to prevent headers from being sent entirely).
64+
* cache_expire, "0"
6465
* cookie_domain, ""
6566
* cookie_httponly, ""
6667
* cookie_lifetime, "0"
@@ -101,6 +102,7 @@ public function __construct(array $options = array(), $handler = null, MetadataB
101102
{
102103
$options += array(
103104
'cache_limiter' => 'private_no_expire',
105+
'cache_expire' => 0,
104106
'use_cookies' => 1,
105107
'lazy_write' => 1,
106108
);
@@ -347,7 +349,7 @@ public function setOptions(array $options)
347349
}
348350

349351
$validOptions = array_flip(array(
350-
'cache_limiter', 'cookie_domain', 'cookie_httponly',
352+
'cache_limiter', 'cache_expire', 'cookie_domain', 'cookie_httponly',
351353
'cookie_lifetime', 'cookie_path', 'cookie_secure',
352354
'entropy_file', 'entropy_length', 'gc_divisor',
353355
'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character',

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/storage.expected

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ $_SESSION is not empty
1515
Array
1616
(
1717
[0] => Content-Type: text/plain; charset=utf-8
18-
[1] => Cache-Control: private, max-age=10800
18+
[1] => Cache-Control: private, max-age=0
1919
)
2020
shutdown

0 commit comments

Comments
 (0)