summaryrefslogtreecommitdiff
path: root/ext/session/session.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2004-02-15 12:58:19 +0000
committerZeev Suraski <zeev@php.net>2004-02-15 12:58:19 +0000
commit7c710a9f9bb65f90d35bdb88d2bc70df1f03b81c (patch)
treefd700bd09f894c07b111c8b7f50c8d6f59da1ef8 /ext/session/session.c
parenta2e1844de9d2584769fbd4a06e7b67e418919198 (diff)
downloadphp-git-7c710a9f9bb65f90d35bdb88d2bc70df1f03b81c.tar.gz
Use zval_ptr_dtor() to free variables as soon as they hit refcount of 0.
Note: You should not be using ZVAL_DELREF() in day to day usage. Instead, you should use zval_ptr_dtor(). Use ZVAL_DELREF() only if you're messing with the refcount directly and know what you're doing. Note #2: For clarity, if you want to initialize a new zval with a refcount of 0, it's best to do that directly, instead of using ZVAL_DELREF after allocating the zval...
Diffstat (limited to 'ext/session/session.c')
-rw-r--r--ext/session/session.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/session/session.c b/ext/session/session.c
index dcb45d0e81..27874f72ee 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -281,7 +281,7 @@ void php_add_session_var(char *name, size_t namelen TSRMLS_DC)
zval *empty_var;
ALLOC_INIT_ZVAL(empty_var); /* this sets refcount to 1 */
- ZVAL_DELREF(empty_var); /* our module does not maintain a ref */
+ empty_var->refcount = 0; /* our module does not maintain a ref */
/* The next call will increase refcount by NR_OF_SYM_TABLES==2 */
zend_set_hash_symbol(empty_var, name, namelen, 1, 2, Z_ARRVAL_P(PS(http_session_vars)), &EG(symbol_table));
} else if (sym_global == NULL) {