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 GitHub
parent 76c23cf9b1
commit 7c3e89ccc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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(),