From b90d4ab7953f0bc394b2a4b63df0aed052a1d3be Mon Sep 17 00:00:00 2001 From: Ian Maddox Date: Thu, 3 Jul 2014 07:36:16 -0700 Subject: [PATCH] session.gc_maxlifetime should be a relative value. 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 php-memcached-dev/php-memcached@39d0beed1cc72947a8cac71ed25fd9d2deb3c274 fixes #142 See also http://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime --- php_memcached_session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php_memcached_session.c b/php_memcached_session.c index de8d1651..d1d45b66 100644 --- a/php_memcached_session.c +++ b/php_memcached_session.c @@ -343,7 +343,7 @@ PS_WRITE_FUNC(memcached) } if (PS(gc_maxlifetime) > 0) { - expiration = PS(gc_maxlifetime); + expiration = time(NULL) + PS(gc_maxlifetime); } /* Set the number of write retry attempts to the number of replicas times the number of attempts to remove a server plus the initial write */