Skip to content

Commit

Permalink
Session: fixed option 'readAndClose' [Closes #206]
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Aug 25, 2021
1 parent 44b80f8 commit 8f58187
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Http/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public function clean(): void
public function setOptions(array $options)
{
$normalized = [];
$allowed = ini_get_all('session', false) + ['read_and_close' => 1, 'session.cookie_samesite' => 1]; // for PHP < 7.3
$allowed = ini_get_all('session', false) + ['session.read_and_close' => 1, 'session.cookie_samesite' => 1]; // for PHP < 7.3

foreach ($options as $key => $value) {
if (!strncmp($key, 'session.', 8)) { // back compatibility
Expand Down
4 changes: 4 additions & 0 deletions tests/Http.DI/SessionExtension.config.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ session:
cookiePath: /x
cookieDomain: domain
cookieSamesite: Lax
readAndClose: yes
services:
foo.request: Nette\Http\Request(Nette\Http\UrlScript("http://www.nette.org"))
Expand All @@ -44,3 +45,6 @@ Assert::same(
: ['lifetime' => 0, 'path' => '/x; SameSite=Lax', 'domain' => 'nette.org', 'secure' => true, 'httponly' => true],
session_get_cookie_params()
);

// readAndClose
Assert::same(PHP_SESSION_NONE, session_status());

0 comments on commit 8f58187

Please sign in to comment.