diff --git a/src/Bridges/HttpDI/SessionExtension.php b/src/Bridges/HttpDI/SessionExtension.php index 68b19f5c..1c0b598b 100644 --- a/src/Bridges/HttpDI/SessionExtension.php +++ b/src/Bridges/HttpDI/SessionExtension.php @@ -91,6 +91,10 @@ public function loadConfiguration() $options['autoStart'] = false; } + if ($config->readAndClose === null) { + unset($options['readAndClose']); + } + if (!empty($options)) { $session->addSetup('setOptions', [$options]); } diff --git a/src/Http/Session.php b/src/Http/Session.php index e8ea880d..ed705e5f 100644 --- a/src/Http/Session.php +++ b/src/Http/Session.php @@ -410,7 +410,7 @@ public function setOptions(array $options) $normalized[$normKey] = $value; } - if (array_key_exists('read_and_close', $normalized)) { + if (isset($normalized['read_and_close'])) { if (session_status() === PHP_SESSION_ACTIVE) { throw new Nette\InvalidStateException('Cannot configure "read_and_close" for already started session.'); }