mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°1835 fix transaction_id lost with session
* transaction_id are now stored by default in file instead of session ("transaction_storage" config parameter : default value was 'Session', it is now 'File')
* session_regenerate_id() call can be disabled using "regenerate_session_id_enabled" config parameter
* new 'transaction_id' parameter type to allow dots (with a file storage, transaction_id equals the temp file name and on Windows we're getting *.tmp)
This commit is contained in:
@@ -1331,15 +1331,24 @@ class UserRights
|
||||
{
|
||||
$_SESSION['profile_list'] = self::ListProfiles();
|
||||
}
|
||||
// Protection against session fixation/injection: generate a new session id.
|
||||
|
||||
// Alas a PHP bug (technically a bug in the memcache session handler, https://bugs.php.net/bug.php?id=71187)
|
||||
// causes session_regenerate_id to fail with a catchable fatal error in PHP 7.0 if the session handler is memcache(d).
|
||||
// The bug has been fixed in PHP 7.2, but in case session_regenerate_id()
|
||||
// fails we just silently ignore the error and keep the same session id...
|
||||
$old_error_handler = set_error_handler(array(__CLASS__, 'VoidErrorHandler'));
|
||||
session_regenerate_id();
|
||||
if ($old_error_handler !== null) set_error_handler($old_error_handler);
|
||||
|
||||
$oConfig = MetaModel::GetConfig();
|
||||
$bSessionIdRegeneration = $oConfig->Get('regenerate_session_id_enabled');
|
||||
if ($bSessionIdRegeneration)
|
||||
{
|
||||
// Protection against session fixation/injection: generate a new session id.
|
||||
|
||||
// Alas a PHP bug (technically a bug in the memcache session handler, https://bugs.php.net/bug.php?id=71187)
|
||||
// causes session_regenerate_id to fail with a catchable fatal error in PHP 7.0 if the session handler is memcache(d).
|
||||
// The bug has been fixed in PHP 7.2, but in case session_regenerate_id()
|
||||
// fails we just silently ignore the error and keep the same session id...
|
||||
$old_error_handler = set_error_handler(array(__CLASS__, 'VoidErrorHandler'));
|
||||
session_regenerate_id();
|
||||
if ($old_error_handler !== null)
|
||||
{
|
||||
set_error_handler($old_error_handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function _ResetSessionCache()
|
||||
|
||||
Reference in New Issue
Block a user