Skip to content
Permalink
Browse files

Update for PHP 7.3

  • Loading branch information
Roland Rabien
Roland Rabien committed Jun 4, 2019
1 parent ef1cee3 commit 1118d337af8c254b43ab15427006f3f25b37a710
Showing with 20 additions and 18 deletions.
  1. +4 −4 php_wincache.c
  2. +1 −1 wincache_utils.c
  3. +15 −13 wincache_zvcache.c
@@ -2524,8 +2524,8 @@ static void wincache_rename(INTERNAL_FUNCTION_PARAMETERS)
WCG(orig_##func) = NULL;\
orig = zend_hash_str_find_ptr(CG(function_table), #func, sizeof(#func)-1); \
if (orig && orig->type == ZEND_INTERNAL_FUNCTION) { \
WCG(orig_##func) = orig->internal_function.handler; \
orig->internal_function.handler = wincache_##func; \
WCG(orig_##func) = (void (__cdecl *)(zend_execute_data *,zval *)) orig->internal_function.handler; \
orig->internal_function.handler = (zif_handler) wincache_##func; \
}

void wincache_intercept_functions_init()
@@ -2544,15 +2544,15 @@ void wincache_intercept_functions_init()
WINCACHE_INTERCEPT(readfile);
WINCACHE_INTERCEPT(realpath);
WINCACHE_INTERCEPT(unlink);
WINCACHE_INTERCEPT(rename);
WINCACHE_INTERCEPT(rename);
dprintverbose("wincache_intercept_functions_init called");
}
/* }}} */

/* {{{ void wincache_intercept_functions_shutdown() */
#define WINCACHE_RELEASE(func) \
if (WCG(orig_##func) && NULL != (orig = zend_hash_str_find_ptr(CG(function_table), #func, sizeof(#func)-1))) { \
orig->internal_function.handler = WCG(orig_##func); \
orig->internal_function.handler = (zif_handler) WCG(orig_##func); \
} \
WCG(orig_##func) = NULL;

@@ -1308,7 +1308,7 @@ const char * utils_get_typename(zend_uchar type)
case IS_REFERENCE:
valuetype = "reference";
break;
case IS_CONSTANT:
//case IS_CONSTANT:
case IS_CONSTANT_AST:
valuetype = "constant";
break;
@@ -211,6 +211,8 @@ static int copyin_zval(zvcache_context * pcache, zvcopy_context * pcopy, HashTab
break;

case IS_STRING:
#if 0
// Do we need to handle IS_CONSTANT_AST
case IS_CONSTANT:
result = copyin_string(pcopy, phtable, Z_STR_P(poriginal), &pzstr);
if (FAILED(result))
@@ -228,7 +230,7 @@ static int copyin_zval(zvcache_context * pcache, zvcopy_context * pcopy, HashTab
/* Use offset in cached zval pointer */
Z_STR_P(pnewzv) = (zend_string *)ZOFFSET(pcopy, pzstr);
break;

#endif
case IS_ARRAY:
/* Initialize zvcopied hashtable for direct call to copyin_zval */
if(phtable == NULL)
@@ -480,7 +482,7 @@ static int copyout_zval(zvcache_context * pcache, zvcopy_context * pcopy, HashTa
break;

case IS_STRING:
case IS_CONSTANT:
//case IS_CONSTANT:
/* create a new, non-persistent string from the cached copy */
ptmp_str = (zend_string *)ZVALUE(pcache->incopy, (size_t)Z_STR_P(pcached));
Z_STR_P(pnewzv) = zend_string_alloc(ZSTR_LEN(ptmp_str), 0);
@@ -620,10 +622,10 @@ static int copyin_hashtable(zvcache_context * pcache, zvcopy_context * pcopy, Ha
pnew_table->pDestructor = NULL;

/* fix up the HashTable flags since we're persisting it */
GC_REFCOUNT(pnew_table) = 2;
GC_INFO(pnew_table) = 0;
GC_FLAGS(pnew_table) &= ~IS_ARRAY_IMMUTABLE;
pnew_table->u.flags &= ~HASH_FLAG_PERSISTENT;
GC_SET_REFCOUNT(pnew_table, 2);
GC_TYPE_INFO(pnew_table) &= ~GC_INFO_MASK;
GC_DEL_FLAGS(pnew_table, IS_ARRAY_IMMUTABLE);
GC_DEL_FLAGS(pnew_table, IS_ARRAY_PERSISTENT);

/* Uninitalized */
if (!(pnew_table->u.flags & HASH_FLAG_INITIALIZED)) {
@@ -764,7 +766,7 @@ static int copyout_hashtable(zvcache_context * pcache, zvcopy_context * pcopy, H
{
if((pnew_table = zend_hash_index_find_ptr(phtable, (zend_ulong)pcached)) != NULL)
{
++GC_REFCOUNT(pnew_table);
GC_ADDREF(pnew_table);
*ppcopied = pnew_table;
goto Finished;
}
@@ -827,7 +829,7 @@ static int copyout_hashtable(zvcache_context * pcache, zvcopy_context * pcopy, H
ptmp_str = (zend_string *)ZVALUE(pcache->incopy, (size_t)p->key);
p->key = zend_string_alloc(ZSTR_LEN(ptmp_str), 0);
memcpy(ZSTR_VAL(p->key), ZSTR_VAL(ptmp_str), ZSTR_LEN(ptmp_str)+1);
++GC_REFCOUNT(p->key);
GC_ADDREF(p->key);
}

/* copy out the data itself */
@@ -891,7 +893,7 @@ static int copyin_string(zvcopy_context * pcopy, HashTable *phtable, zend_string
{
*(((char *)pzstr) + size - 1) = 0;
zend_string_forget_hash_val(pzstr);
GC_FLAGS(pzstr) &= ~(IS_STR_INTERNED | IS_STR_PERMANENT | IS_STR_PERSISTENT);
GC_DEL_FLAGS(pzstr, IS_STR_INTERNED | IS_STR_PERMANENT | IS_STR_PERSISTENT);
}

*new_string = pzstr;
@@ -925,8 +927,8 @@ static int copyin_reference(zvcache_context * pcache, zvcopy_context * pcopy, Ha
{
pnew_zval = &pzref->val;
result = copyin_zval(pcache, pcopy, phtable, pnew_zval, &pnew_zval);
GC_REFCOUNT(pzref) = 2;
GC_INFO(pzref) = 0;
GC_SET_REFCOUNT(pzref, 2);
GC_TYPE_INFO(pzref) &= ~GC_INFO_MASK;
}

*new_ref = pzref;
@@ -954,7 +956,7 @@ static int copyout_reference(zvcache_context * pcache, zvcopy_context * pcopy, H
{
if((pzref = zend_hash_index_find_ptr(phtable, (zend_ulong)pcached)) != NULL)
{
++GC_REFCOUNT(pzref);
GC_ADDREF(pzref);
*ppnew_ref = pzref;
goto Finished;
}
@@ -1163,7 +1165,7 @@ static void destroy_zvcache_data(zvcache_context * pcache, zvcache_value * pvalu
break;

case IS_STRING:
case IS_CONSTANT:
//case IS_CONSTANT:
ZFREE(pcache->incopy, ZVALUE(pcache->incopy, (size_t)Z_STR_P(pzval)));
Z_STR_P(pzval) = NULL;
break;

0 comments on commit 1118d33

Please sign in to comment.
You can’t perform that action at this time.