1
0
Fork 0
Browse Source

1.2: fixed #56: xcache_set segfaults when xcache.var_size=0

git-svn-id: svn://svn.lighttpd.net/xcache/branches/1.2@328 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
1.2
Xuefer 16 years ago
parent
commit
4aaf9e475d
  1. 6
      NEWS
  2. 29
      xcache.c

6
NEWS

@ -1,3 +1,9 @@
1.2.1 2007-?-?
== NEWS ==
== ChangeLog ==
* fixed #56: xcache_set segfaults when xcache.var_size=0
========
1.2.0 2006-12-10
NEWS
========

29
xcache.c

@ -1695,6 +1695,10 @@ PHP_FUNCTION(xcache_clear_cache)
}
/* }}} */
#define VAR_DISABLED_WARNING() do { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "xcache.var_size is either 0 or too small to enable var data caching"); \
} while (0)
static int xc_entry_init_key_var(xc_entry_t *xce, zval *name TSRMLS_DC) /* {{{ */
{
xc_hash_value_t hv;
@ -1737,6 +1741,11 @@ PHP_FUNCTION(xcache_get)
xc_entry_data_var_t var;
zval *name;
if (!xc_var_caches) {
VAR_DISABLED_WARNING();
RETURN_NULL();
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &name) == FAILURE) {
return;
}
@ -1769,6 +1778,11 @@ PHP_FUNCTION(xcache_set)
zval *name;
zval *value;
if (!xc_var_caches) {
VAR_DISABLED_WARNING();
RETURN_NULL();
}
xce.ttl = XG(var_ttl);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &name, &value, &xce.ttl) == FAILURE) {
return;
@ -1800,6 +1814,11 @@ PHP_FUNCTION(xcache_isset)
xc_entry_data_var_t var;
zval *name;
if (!xc_var_caches) {
VAR_DISABLED_WARNING();
RETURN_FALSE;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &name) == FAILURE) {
return;
}
@ -1831,6 +1850,11 @@ PHP_FUNCTION(xcache_unset)
xc_entry_data_var_t var;
zval *name;
if (!xc_var_caches) {
VAR_DISABLED_WARNING();
RETURN_FALSE;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &name) == FAILURE) {
return;
}
@ -1858,6 +1882,11 @@ static inline void xc_var_inc_dec(int inc, INTERNAL_FUNCTION_PARAMETERS) /* {{{
long value = 0;
zval oldzval;
if (!xc_var_caches) {
VAR_DISABLED_WARNING();
RETURN_NULL();
}
xce.ttl = XG(var_ttl);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", &name, &count, &xce.ttl) == FAILURE) {
return;

Loading…
Cancel
Save