Skip to content

Commit

Permalink
Fix: env error on undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinBubu committed Oct 27, 2021
1 parent 22bf179 commit 9c9baa7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Session/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ public function __construct(?int $sessionCache = null, ?int $sessionLifetime = n
{
if (session_status() !== PHP_SESSION_ACTIVE) {

if (is_null($sessionLifetime)) $sessionLifetime = $_ENV['SESSION_DURATION'];
if (is_null($sessionLifetime)) $sessionLifetime = $_ENV['SESSION_DURATION'] ?? 0;

ini_set('session.gc_maxlifetime', $sessionLifetime * 60 * 60 * 24);
session_set_cookie_params($sessionLifetime * 60 * 60 * 24);

if (is_null($sessionCache)) $sessionCache = $_ENV['HTTP_EXPIRES'];
if (is_null($sessionCache)) $sessionCache = $_ENV['HTTP_EXPIRES'] ?? 0;

session_cache_expire($sessionCache);
session_cache_limiter($_ENV['SESSION_CACHE_LIMITER']);
session_cache_limiter($_ENV['SESSION_CACHE_LIMITER'] ?? 'private');
session_start();
}
}
Expand Down

0 comments on commit 9c9baa7

Please sign in to comment.