Skip to content

Commit

Permalink
Compatible with PHP-8.0-alpha2 (#3458)
Browse files Browse the repository at this point in the history
  • Loading branch information
twose authored Jul 10, 2020
1 parent ca587dd commit 93d43ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 7 additions & 5 deletions php_swoole.h
Original file line number Diff line number Diff line change
Expand Up @@ -628,23 +628,23 @@ void php_swoole_sha256(const char *str, int _len, uchar *digest);
else {k = ZSTR_VAL(_foreach_key), klen=ZSTR_LEN(_foreach_key); ktype = 1;} {
#define SW_HASHTABLE_FOREACH_END() } ZEND_HASH_FOREACH_END();

static sw_inline int add_assoc_ulong_safe_ex(zval *arg, const char *key, size_t key_len, zend_ulong value)
static sw_inline void add_assoc_ulong_safe_ex(zval *arg, const char *key, size_t key_len, zend_ulong value)
{
if (sw_likely(value <= ZEND_LONG_MAX))
{
return add_assoc_long_ex(arg, key, key_len, value);
add_assoc_long_ex(arg, key, key_len, value);
}
else
{
char buf[MAX_LENGTH_OF_LONG + 1];
size_t len = sw_snprintf(buf, sizeof(buf), ZEND_ULONG_FMT, value);
return add_assoc_stringl_ex(arg, key, key_len, buf, len);
add_assoc_stringl_ex(arg, key, key_len, buf, len);
}
}

static sw_inline int add_assoc_ulong_safe(zval *arg, const char *key, zend_ulong value)
static sw_inline void add_assoc_ulong_safe(zval *arg, const char *key, zend_ulong value)
{
return add_assoc_ulong_safe_ex(arg, key, strlen(key), value);
add_assoc_ulong_safe_ex(arg, key, strlen(key), value);
}

//----------------------------------Class API------------------------------------
Expand Down Expand Up @@ -1000,7 +1000,9 @@ static sw_inline int sw_zend_call_function_ex(zval *function_name, zend_fcall_in
fci.retval = retval ? retval : &_retval;
fci.param_count = param_count;
fci.params = params;
#if PHP_VERSION_ID < 80000
fci.no_separation = 0;
#endif

ret = zend_call_function(&fci, fci_cache);

Expand Down
2 changes: 2 additions & 0 deletions swoole_runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1888,7 +1888,9 @@ static PHP_FUNCTION(swoole_user_func_handler)
fci.retval = return_value;
fci.param_count = ZEND_NUM_ARGS();
fci.params = ZEND_CALL_ARG(execute_data, 1);
#if PHP_VERSION_ID < 80000
fci.no_separation = 1;
#endif

real_func *rf = (real_func *) zend_hash_find_ptr(function_table, execute_data->func->common.function_name);
zend_call_function(&fci, rf->fci_cache);
Expand Down

0 comments on commit 93d43ce

Please sign in to comment.