trunk: merged 328, fixed #56: xcache_set segfaults when xcache.var_size=0
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@329 c26eb9a1-5813-0410-bd6c-c2e55f420ca73.0
parent
5eaa9b12e8
commit
563648330f
6
NEWS
6
NEWS
|
@ -1,3 +1,9 @@
|
|||
2.0.0 2007-?-?
|
||||
== NEWS ==
|
||||
== ChangeLog ==
|
||||
* fixed #56: xcache_set segfaults when xcache.var_size=0
|
||||
|
||||
========
|
||||
1.2.0 2006-12-10
|
||||
NEWS
|
||||
========
|
||||
|
|
29
xcache.c
29
xcache.c
|
@ -1864,6 +1864,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;
|
||||
|
@ -1906,6 +1910,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;
|
||||
}
|
||||
|
@ -1938,6 +1947,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;
|
||||
|
@ -1969,6 +1983,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;
|
||||
}
|
||||
|
@ -2000,6 +2019,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;
|
||||
}
|
||||
|
@ -2027,6 +2051,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…
Reference in New Issue