8000 bug #24691 [HttpFoundation] Fix caching of session-enabled pages (nic… · symfony/symfony@fdac9e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit fdac9e3

Browse files
committed
bug #24691 [HttpFoundation] Fix caching of session-enabled pages (nicolas-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
2 parents e1daff4 + 572e02c commit fdac9e3

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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

Lines changed: 4 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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)
0