From 3f4f3454f8fb02987691d5c437a747d276284713 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Tue, 20 Feb 2018 23:14:36 +0100 Subject: [PATCH] Centralize stopping session --- adminer/include/auth.inc.php | 4 +--- adminer/include/functions.inc.php | 9 +++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/adminer/include/auth.inc.php b/adminer/include/auth.inc.php index c25dc33f..71a71349 100644 --- a/adminer/include/auth.inc.php +++ b/adminer/include/auth.inc.php @@ -158,9 +158,7 @@ if (isset($_GET["username"]) && !class_exists("Min_DB")) { exit; } -if (!ini_bool("session.use_cookies") || @ini_set("session.use_cookies", false) !== false) { // @ - may be disabled - session_write_close(); // improves concurrency if a user opens several pages at once, may be restarted later -} +stop_session(true); if (isset($_GET["username"])) { list($host, $port) = explode(":", SERVER, 2); diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index d599d1af..4742414e 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -564,12 +564,13 @@ function restart_session() { } } -/** Stop session if it would be possible to restart it later +/** Stop session if possible +* @param bool * @return null */ -function stop_session() { - if (!ini_bool("session.use_cookies")) { - session_write_close(); +function stop_session($force = false) { + if (!ini_bool("session.use_cookies") || ($force && @ini_set("session.use_cookies", false) !== false)) { // @ - may be disabled + session_write_close(); // improves concurrency if a user opens several pages at once, may be restarted later } }