}
/* }}} */
+
+static void php_session_gc(void) /* {{{ */
+{
+ int nrand;
+
+ /* GC must be done before reading session data. */
+ if ((PS(mod_data) || PS(mod_user_implemented)) && PS(gc_probability) > 0) {
+ int nrdels = -1;
+
+ nrand = (int) ((float) PS(gc_divisor) * php_combined_lcg(TSRMLS_C));
+ if (nrand < PS(gc_probability)) {
+ PS(mod)->s_gc(&PS(mod_data), PS(gc_maxlifetime), &nrdels TSRMLS_CC);
+#ifdef SESSION_DEBUG
+ if (nrdels != -1) {
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "purged %d expired session objects", nrdels);
+ }
+#endif
+ }
+ }
+} /* }}} */
+
+
static void php_session_initialize(TSRMLS_D) /* {{{ */
{
char *val = NULL;
PS(session_status) = php_session_active;
}
+ /* GC must be done before read */
+ php_session_gc();
+
/* Read data */
php_session_track_init(TSRMLS_C);
if (PS(mod)->s_read(&PS(mod_data), PS(id), &val, &vallen TSRMLS_CC) == FAILURE) {
zval **ppid;
zval **data;
char *p, *value;
- int nrand;
int lensess;
if (PS(use_only_cookies)) {
PS(id) = NULL;
}
- /* GC must be done before reading session data. */
- if ((PS(mod_data) || PS(mod_user_implemented)) && PS(gc_probability) > 0) {
- int nrdels = -1;
-
- nrand = (int) ((float) PS(gc_divisor) * php_combined_lcg(TSRMLS_C));
- if (nrand < PS(gc_probability)) {
- PS(mod)->s_gc(&PS(mod_data), PS(gc_maxlifetime), &nrdels TSRMLS_CC);
-#ifdef SESSION_DEBUG
- if (nrdels != -1) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "purged %d expired session objects", nrdels);
- }
-#endif
- }
- }
-
php_session_initialize(TSRMLS_C);
php_session_cache_limiter(TSRMLS_C);
}
?>
--EXPECTF--
open: path = /tmp, name = sid
-read: id = %s
gc: maxlifetime = %d
+read: id = %s
write: id = %s, data = A|s:1:"B";
close
open: path = /tmp, name = sid
-read: id = %s
gc: maxlifetime = %d
+read: id = %s
destroy: id = %s
close
open: path = /tmp, name = sid
-read: id = %s
gc: maxlifetime = %d
+read: id = %s
write: id = %s, data = E|s:1:"F";
close