From d13ad37f0c6bf56c2cffbbb3be56b3193a81d793 Mon Sep 17 00:00:00 2001 From: Rodolfo Berrios <20590102+rodber@users.noreply.github.com> Date: Thu, 7 Nov 2024 10:22:59 -0300 Subject: [PATCH] prevent session_start false positive --- app/src/Legacy/functions.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/Legacy/functions.php b/app/src/Legacy/functions.php index b943860..8e83989 100644 --- a/app/src/Legacy/functions.php +++ b/app/src/Legacy/functions.php @@ -1173,15 +1173,24 @@ function loaderHandler( new FilesVar($_files); require_once PATH_APP . 'configurator.php'; if ($_session === []) { - $sessionStart = session_start([ + $session_start = false; + $session_options = [ 'save_handler' => Config::system()->sessionSaveHandler(), 'save_path' => Config::system()->sessionSavePath(), 'cookie_path' => Config::host()->hostnamePath(), 'cookie_domain' => Config::host()->hostname(), 'cookie_secure' => Config::host()->isHttps(), 'cookie_httponly' => true, - ]); - if (! $sessionStart) { + ]; + + try { + $session_start = session_start($session_options); + } catch (Throwable) { + if (session_status() === PHP_SESSION_ACTIVE) { + $session_start = true; + } + } + if (! $session_start) { throw new RuntimeException( 'Sessions not working (session_start)', 600