Create a new session if permission denied on current one (#331)

In a multi-user configuration, the current session file can be unreadable
by the current user. This tries to create a new session in this case.
This commit is contained in:
Nicolas Peugnet 2020-05-24 05:21:44 +02:00 committed by GitHub
parent 5903849388
commit 8fb1816877
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -203,7 +203,17 @@ if (defined('FM_EMBED')) {
session_cache_limiter('');
session_name(FM_SESSION_ID );
@session_start();
function session_error_handling_function($code, $msg, $file, $line) {
// Permission denied for default session, try to create a new one
if ($code == 2) {
session_abort();
session_id(session_create_id());
@session_start();
}
}
set_error_handler('session_error_handling_function');
session_start();
restore_error_handler();
}
if (empty($auth_users)) {