From 201b28bb1b7d21532170c8a2eae4ab526ea0ae73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgaras=20Janu=C5=A1auskas?= Date: Sat, 13 Oct 2018 22:25:02 +0300 Subject: [PATCH] Do not change session handler if session is active Avoid notice "session_set_save_handler(): Cannot change save handler when session is active" on PHP 7.2 --- src/Http/Session.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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(); }