|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #62116 session expiration always use timestamps
Submitted: 2012-05-23 06:56 UTC Modified: 2021-06-09 11:31 UTC
Avg. Score:2.7 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:0 (0.0%)
From: pcdwarf at pcdwarf dot net Assigned: cmb (profile)
Status: Closed Package: memcached (PECL)
PHP Version: 5.3.3 OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: pcdwarf at pcdwarf dot net
New email:
PHP Version: OS:


 [2012-05-23 06:56 UTC] pcdwarf at pcdwarf dot net
The session system always specify expiration by timestamp.
This is ok but it can lead to premature session expiration if the web server and the memcache server do not share the same clock and are out of sync.
I suggest to switch to relative mode and only use absolute mode when session.gc_maxlifetime is greater than 30 days.


Test script:
file php_memcached.c : line 2526

    if (sess_lifetime > 0) {
        expiration = time(NULL) + sess_lifetime;
    } else {
        expiration = 0;

can be

    if (sess_lifetime > 0) {
        expiration = sess_lifetime;
        if (sess_lifetime >= 2592000) expiration += time(NULL);
    } else {
        expiration = 0;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-23 07:01 UTC] pcdwarf at pcdwarf dot net
-PHP Version: 5.4.3 +PHP Version: 5.3.3
 [2012-05-23 07:01 UTC] pcdwarf at pcdwarf dot net
oops; ths is for php 5.3.
I didn't checked the same bug exists for 5.4
 [2021-06-09 11:31 UTC]
The memcached bug tracker is now on Github[1].  If this is still
an issue with the current memcached version, please report there.

[1] <>
 [2021-06-09 11:31 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 26 18:01:33 2024 UTC