|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-03-06 13:50 UTC] andrei@php.net
[2012-03-07 05:43 UTC] andrei@php.net
[2012-03-07 05:43 UTC] andrei@php.net
-Status: Analyzed
+Status: Closed
-Assigned To:
+Assigned To: andrei
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 15:00:01 2025 UTC |
Description: ------------ Sessions never expire when using the "memcached" handler. zend_ini_long() expects a string length including the termination zero byte. As such, the ZEND_STRS macro has to be used and not the ZEND_STRL. At least the following values should be affected in php_memcached.c: "max_execution_time" as well as "session.gc_maxlifetime". Reproduce code: --------------- Set "gc_maxlifetime" to a non-zero value, start a session using session_start() and capture the packets going to the Memcached server. Patch: --- memcached-1.0.2/php_memcached.c.orig 1970-01-01 10:13:08.000000000 +0100 +++ memcached-1.0.2/php_memcached.c 2011-02-26 21:51:07.652023126 +0100 @@ -2412,7 +2412,7 @@ memcached_return status; /* set max timeout for session_start = max_execution_time. (c) Andrei Darashenka, Richter & Poweleit GmbH */ - lock_maxwait = zend_ini_long(ZEND_STRL("max_execution_time"), 0); + lock_maxwait = zend_ini_long(ZEND_STRS("max_execution_time"), 0); if (lock_maxwait <= 0) { lock_maxwait = MEMC_SESS_LOCK_EXPIRATION; } @@ -2522,7 +2522,7 @@ memcached_st *memc_sess = PS_GET_MOD_DATA(); sess_key_len = spprintf(&sess_key, 0, "memc.sess.key.%s", key); - sess_lifetime = zend_ini_long(ZEND_STRL("session.gc_maxlifetime"), 0); + sess_lifetime = zend_ini_long(ZEND_STRS("session.gc_maxlifetime"), 0); if (sess_lifetime > 0) { expiration = time(NULL) + sess_lifetime; } else { Expected result: ---------------- The expiration time should be time() + gc_maxlifetime. Actual result: -------------- The expiration time is 0.