Skip to content

session.gc_maxlifetime should always be a relative value.#143

Closed
ianmaddox wants to merge 1 commit into
php-memcached-dev:masterfrom
ianmaddox:master
Closed

session.gc_maxlifetime should always be a relative value.#143
ianmaddox wants to merge 1 commit into
php-memcached-dev:masterfrom
ianmaddox:master

Conversation

@ianmaddox

Copy link
Copy Markdown

Without the addition of time(NULL), any value greater than 2678400 (30 days)
is treated as absolute. A 31 day gc_maxlifetime would result in empty sessions
because the memcached data is immediately timed out.

introduced in commit 39d0bee
fixes #142

Without the addition of time(NULL), any value greater than 2678400 (30 days)
is treated as absolute.  A 31 day gc_maxlifetime would result in empty sessions
because the memcached data is immediately timed out.

introduced in commit 39d0bee
fixes #142

See also http://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime
@ianmaddox ianmaddox changed the title session.gc_maxlifetime should be a relative value. session.gc_maxlifetime should always be a relative value. Jul 3, 2014
@mkoppanen

Copy link
Copy Markdown
Member

Am I to understand that the functionality has been released in 2.2.0 and the latest stable?

@ianmaddox

Copy link
Copy Markdown
Author

Yes, I believe that is correct. I've actually run into this issue a few
times in the past several years, but always figured someone else would
handle it.
On Jul 15, 2014 6:22 PM, "Mikko Koppanen" notifications@github.com wrote:

Am I to understand that the functionality has been released in 2.2.0 and
the latest stable?


Reply to this email directly or view it on GitHub
#143 (comment)
.

@isotopp

isotopp commented Mar 17, 2015

Copy link
Copy Markdown

Why is this pull request abandoned? It should have been merged a year ago.

@sodabrew

Copy link
Copy Markdown
Collaborator

One problem now is that some consumers of this library add their own timestamps to work around the removal of the time(NULL) in the php-memcached module.

Another problem is that the semantics of memcached itself specifically define 30-days as the transition point from relative time in seconds to absolute time in epoch seconds. The previous behavior was tripping up people who were providing absolute times.

A reasonable heuristic might be to add time(NULL) only if the timestamp is less than one billion. The epoch time for January 2017 starts around 1.483 billion.

@sodabrew

Copy link
Copy Markdown
Collaborator

And as it turns out, almost exactly that idea was implemented in 27a22f3. Closing as resolved!

@sodabrew sodabrew closed this Jan 24, 2017
@sodabrew sodabrew added this to the 3.0.0 milestone Jan 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session values greater than 30 days expire immediately.

4 participants