diff --git a/include/functions_session.inc.php b/include/functions_session.inc.php index afa52b36f..b36b39743 100644 --- a/include/functions_session.inc.php +++ b/include/functions_session.inc.php @@ -10,24 +10,25 @@ * @package functions\session */ +// In PHP 8.4+ calling session_set_save_handler with +// two parameters is deprecated. To correct this, +// we pass a SessionHandlerInterface instance. +// https://github.com/Piwigo/Piwigo/issues/2296 +// Depending on the PHP version, we include the appropriate +// session handler class file. +if (version_compare(PHP_VERSION, '8.0.0') < 0) +{ + include_once(PHPWG_ROOT_PATH.'/include/pwgsession_php7.class.php'); +} +else +{ + include_once(PHPWG_ROOT_PATH.'/include/pwgsession.class.php'); +} + if (isset($conf['session_save_handler']) and ($conf['session_save_handler'] == 'db') and defined('PHPWG_INSTALLED')) { - // In PHP 8.4+ calling session_set_save_handler with - // two parameters is deprecated. To correct this, - // we pass a SessionHandlerInterface instance. - // https://github.com/Piwigo/Piwigo/issues/2296 - // Depending on the PHP version, we include the appropriate - // session handler class file. - if (version_compare(PHP_VERSION, '8.0.0') < 0) - { - include_once(PHPWG_ROOT_PATH.'/include/pwgsession_php7.class.php'); - } - else - { - include_once(PHPWG_ROOT_PATH.'/include/pwgsession.class.php'); - } session_set_save_handler(new PwgSession()); if (function_exists('ini_set'))