Skip to content

Commit 9c9baa7

Browse files
committed
Fix: env error on undefined
1 parent 22bf179 commit 9c9baa7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Session/Session.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ public function __construct(?int $sessionCache = null, ?int $sessionLifetime = n
1010
{
1111
if (session_status() !== PHP_SESSION_ACTIVE) {
1212

13-
if (is_null($sessionLifetime)) $sessionLifetime = $_ENV['SESSION_DURATION'];
13+
if (is_null($sessionLifetime)) $sessionLifetime = $_ENV['SESSION_DURATION'] ?? 0;
1414

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

18-
if (is_null($sessionCache)) $sessionCache = $_ENV['HTTP_EXPIRES'];
18+
if (is_null($sessionCache)) $sessionCache = $_ENV['HTTP_EXPIRES'] ?? 0;
1919

2020
session_cache_expire($sessionCache);
21-
session_cache_limiter($_ENV['SESSION_CACHE_LIMITER']);
21+
session_cache_limiter($_ENV['SESSION_CACHE_LIMITER'] ?? 'private');
2222
session_start();
2323
}
2424
}

0 commit comments

Comments
 (0)