Skip to content

Commit

Permalink
Use session_status to check session, fixes #8
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanjhv committed Nov 18, 2016
1 parent df4282d commit ccc0c7e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Slim/Middleware/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ protected function startSession()
$settings['httponly']
);

if (session_id()) {
$active = session_status() === PHP_SESSION_ACTIVE;

if ($active) {
if ($settings['autorefresh'] && isset($_COOKIE[$name])) {
setcookie(
$name,
Expand All @@ -104,6 +106,8 @@ protected function startSession()

session_name($name);
session_cache_limiter(false);
session_start();
if (!$active) {
session_start();
}
}
}

0 comments on commit ccc0c7e

Please sign in to comment.