Topic: Session error

Hello, I got this error:

ini_set(): A session is active. You cannot change the session module's ini settings at this time in file: /var/www/vhosts/frefelweb.ch/fa-dev2.frefelweb.ch/includes/session.inc at line 430

What does it means?

Re: Session error

There were some changes to this file includes/session.inc in Nov/Dec 2017 that fixed some session errors as well. Using the Git Master and appropriately adjusting the config.php based on the latest config.default.inc will fix the issue. Additional entries in the sys_prefs table may also be in order - compare with latest sql/en_US-new.sql.

Re: Session error

I'm getting the same message (warning?) with code version 2.4.4 (de943e150d36f815a02d4996e532a5e4e7510bc8) and PHP 7.2.3 (XAMPP 2018-03-14) with debugging on.

This message seems to be related to trying to change the ini setting after the session has started, which was being silently ignored in earlier versions of PHP but is now being reported. Refer https://stackoverflow.com/questions/48209844/ini-set-fails-to-set-session-variables-php-7-2-0-and-higher

I propose that the ini_set be moved before the new SessionManager() [as follows]

-------------------------------------------------------
includes/session.inc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/includes/session.inc b/includes/session.inc
index 3f8c525d..779dc4e6 100644
--- a/includes/session.inc
+++ b/includes/session.inc
@@ -394,6 +394,9 @@ function login_timeout()
    if (file_exists($path_to_root.'/'.$ext['path'].'/hooks.php'))
        include_once($path_to_root.'/'.$ext['path'].'/hooks.php');
}
+
+ini_set('session.gc_maxlifetime', 36000); // 10hrs
+
$Session_manager = new SessionManager();
$Session_manager->sessionStart('FA'.md5(dirname(__FILE__)));

@@ -429,7 +432,7 @@ function login_timeout()
*/
// ini_set('session.save_path', VARLIB_PATH.'/');

-ini_set('session.gc_maxlifetime', 36000); // 10hrs
+// ini_set('session.gc_maxlifetime', 36000); // 10hrs

hook_session_start(@$_POST["company_login_name"]);
-------------------------------------------------------

Thanks.

Re: Session error

Thanks for reporting. This will be fixed asap.

Currently there are problems committing to Sourceforge Git, but as soon as it is working again, it will be committed.

/Joe

Committed.

Re: Session error

This is still an issue ref here

6 (edited by cleal 10/25/2018 09:59:12 pm)

Re: Session error

This solution works fine!

cleal