File tree 1 file changed +15
-3
lines changed
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ extern ZEND_DECLARE_MODULE_GLOBALS(php_memcached)
25
25
#define MEMC_SESS_DEFAULT_LOCK_WAIT 150000
26
26
#define MEMC_SESS_LOCK_EXPIRATION 30
27
27
28
+ #define REALTIME_MAXDELTA 60*60*24*30
29
+
28
30
ps_module ps_mod_memcached = {
29
31
PS_MOD_UPDATE_TIMESTAMP (memcached )
30
32
};
@@ -92,16 +94,26 @@ int php_memc_session_minit(int module_number)
92
94
return SUCCESS ;
93
95
}
94
96
97
+ static
98
+ time_t s_adjust_expiration (zend_long expiration )
99
+ {
100
+ if (expiration <= REALTIME_MAXDELTA ) {
101
+ return expiration ;
102
+ } else {
103
+ return time (NULL ) + expiration ;
104
+ }
105
+ }
106
+
95
107
static
96
108
time_t s_lock_expiration ()
97
109
{
98
110
if (MEMC_SESS_INI (lock_expiration ) > 0 ) {
99
- return time ( NULL ) + MEMC_SESS_INI (lock_expiration );
111
+ return s_adjust_expiration ( MEMC_SESS_INI (lock_expiration ) );
100
112
}
101
113
else {
102
114
zend_long max_execution_time = zend_ini_long (ZEND_STRS ("max_execution_time" ), 0 );
103
115
if (max_execution_time > 0 ) {
104
- return time ( NULL ) + max_execution_time ;
116
+ return s_adjust_expiration ( max_execution_time ) ;
105
117
}
106
118
}
107
119
return 0 ;
@@ -111,7 +123,7 @@ static
111
123
time_t s_session_expiration (zend_long maxlifetime )
112
124
{
113
125
if (maxlifetime > 0 ) {
114
- return time ( NULL ) + maxlifetime ;
126
+ return s_adjust_expiration ( maxlifetime ) ;
115
127
}
116
128
return 0 ;
117
129
}
You can’t perform that action at this time.
0 commit comments