diff --git a/src/Http/Session.php b/src/Http/Session.php index d6c73c05038..cf66df7e1dc 100644 --- a/src/Http/Session.php +++ b/src/Http/Session.php @@ -290,7 +290,7 @@ public function engine($class = null, array $options = []) */ protected function setEngine(SessionHandlerInterface $handler) { - if (!headers_sent()) { + if (!headers_sent() && session_status() !== \PHP_SESSION_ACTIVE) { session_set_save_handler($handler, false); } @@ -535,7 +535,7 @@ public function destroy() $this->start(); } - if (!$this->_isCLI && session_status() === PHP_SESSION_ACTIVE) { + if (!$this->_isCLI && session_status() === \PHP_SESSION_ACTIVE) { session_destroy(); }