Skip to content

Commit

Permalink
Do not change session handler if session is active
Browse files Browse the repository at this point in the history
Avoid notice "session_set_save_handler(): Cannot change save handler when session is active" on PHP 7.2
  • Loading branch information
garas committed Oct 13, 2018
1 parent cb3034e commit 201b28b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Http/Session.php
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit 201b28b

Please sign in to comment.