From 155381237a76f93a5a84999082261d3728232ea2 Mon Sep 17 00:00:00 2001 From: anuko Date: Sun, 12 Nov 2017 17:19:21 +0000 Subject: [PATCH] Introduced PHP_SESSION_PATH define to avoid session deletions by other scripts. --- WEB-INF/config.php.dist | 6 ++++++ WEB-INF/templates/footer.tpl | 2 +- initialize.php | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/WEB-INF/config.php.dist b/WEB-INF/config.php.dist index 55f34749..3cfbb07b 100644 --- a/WEB-INF/config.php.dist +++ b/WEB-INF/config.php.dist @@ -112,6 +112,12 @@ define('WEEKEND_START_DAY', 6); // define('PHPSESSID_TTL', 86400); +// PHP_SESSION_PATH +// Local file system path for PHP sessions. Use it to isolate session deletions +// (garbage collection interference) by other PHP scripts potentially running on the system. +// define('PHP_SESSION_PATH', '/tmp/timetracker'); // Directory must exist and be writable. + + // Forum and help links from the main menu. // define('FORUM_LINK', 'https://www.anuko.com/forum/viewforum.php?f=4'); diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 823659e6..0f14b905 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.12.2.3683 | Copyright © Anuko | +  Anuko Time Tracker 1.12.3.3684 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/initialize.php b/initialize.php index 1a508e94..c9a42458 100644 --- a/initialize.php +++ b/initialize.php @@ -84,6 +84,12 @@ session_cache_expire(1); $phpsessid_ttl = defined('PHPSESSID_TTL') ? PHPSESSID_TTL : 60*60*24; // Set lifetime for garbage collection. ini_set('session.gc_maxlifetime', $phpsessid_ttl); +// Set PHP session path, if defined to avoid garbage collection interference from other scripts. +if (defined('PHP_SESSION_PATH')) { + ini_set('session.save_path', PHP_SESSION_PATH); + ini_set('session.gc_probability', 1); +} + // Set session cookie lifetime. session_set_cookie_params($phpsessid_ttl); if (isset($_COOKIE['tt_PHPSESSID'])) { -- 2.20.1