Skip to content

Conversation

@arlomedia
Copy link

@arlomedia arlomedia commented Jun 26, 2025

Simplify the session lifetime calculations and always use the setting from the user interface.

From #8134

Simplify the session lifetime calculations and always use the setting from the user interface.
@jdarwood007
Copy link
Member

jdarwood007 commented Jun 28, 2025

I would prefer to see it like this, anyone concur?

@ini_set('session.gc_maxlifetime', max(min(Config::$modSettings['databaseSession_lifetime'], Config::$modSettings['databaseSession_lifetime']), 60));

Get the lowest of the server or SMF settings and ensure they have a sane value of at least 60.

@arlomedia
Copy link
Author

This seems like a mistake: min(Config::$modSettings['databaseSession_lifetime'], Config::$modSettings['databaseSession_lifetime']). It sounds like you meant to write min(ini_get('session.gc_maxlifetime'), Config::$modSettings['databaseSession_lifetime']).

How about just max(Config::$modSettings['databaseSession_lifetime'], 60)? Then users could set it higher or lower than the server default setting.

@jdarwood007
Copy link
Member

Ooops, I did typo that, but yes:

@ini_set('session.gc_maxlifetime', min(ini_get('session.gc_maxlifetime'), Config::$modSettings['databaseSession_lifetime']), 60));

@jdarwood007 jdarwood007 changed the title Issue 8134 [2.1] Issue 8134 Jul 5, 2025
@isaak654
Copy link
Contributor

Aside from editing the title, if this pull request cannot be repurposed for branch 2.1, it may be preferable to submit a new one.

@jdarwood007 jdarwood007 changed the title [2.1] Issue 8134 [3.0] Issue 8134 Oct 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants