Fix "expires" option cannot have a year greater than 9999 (#1246)

This fixes the exception: '"expires" option cannot have a year greater
than 9999', which happens on upgrade from Debian 11 to 12. The session
timeout in the DB is 9999999999999, so we constrain the value.
This commit is contained in:
Wiebe Cazemier 2024-03-23 15:14:11 +01:00 committed by Michael Kaufmann
parent 809e8ef45b
commit 5909401cdd
2 changed files with 2 additions and 1 deletions

View File

@ -35,6 +35,7 @@ return [
'varname' => 'sessiontimeout',
'type' => 'number',
'min' => 60,
'max' => 31536000,
'default' => 600,
'save_method' => 'storeSettingField'
],

View File

@ -369,7 +369,7 @@ if (CurrentUser::hasSession()) {
}
// update cookie lifetime
$cookie_params = [
'expires' => time() + Settings::Get('session.sessiontimeout'),
'expires' => time() + min(Settings::Get('session.sessiontimeout'), 31536000),
'path' => '/',
'domain' => UI::getCookieHost(),
'secure' => UI::requestIsHttps(),