Skip to content

Commit

Permalink
Merge pull request #2139 from dreamsxin/php8
Browse files Browse the repository at this point in the history
Php8
  • Loading branch information
AlexNDRmac authored Feb 2, 2021
2 parents c038db0 + 0c526b9 commit a9abeba
Show file tree
Hide file tree
Showing 38 changed files with 54 additions and 24 deletions.
Empty file modified kernels/ZendEngine3/README.md
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/array.c
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/array.h
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/backtrace.c
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/backtrace.h
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/debug.c
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/debug.h
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/exception.c
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/exception.h
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/exit.c
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/exit.h
100644 → 100755
Empty file.
61 changes: 54 additions & 7 deletions kernels/ZendEngine3/fcall.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -231,26 +231,69 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
fcic->object = this_ptr ? Z_OBJ_P(this_ptr) : NULL;
switch (type) {
case zephir_fcall_parent:

#if PHP_VERSION_ID >= 80000
if (ce && Z_TYPE_P(func) == IS_STRING) {
fcic->function_handler = zend_hash_find_ptr(&ce->parent->function_table, Z_STR_P(func));

fcic->calling_scope = ce->parent;
} else if (EXPECTED(calling_scope && calling_scope->parent)) {
if (Z_TYPE_P(func) == IS_STRING) {
fcic->function_handler = zend_hash_find_ptr(&calling_scope->parent->function_table, Z_STR_P(func));
}
fcic->calling_scope = calling_scope->parent;
} else {
return;
}
#endif
if (UNEXPECTED(!calling_scope || !calling_scope->parent)) {
return;
}

fcic->calling_scope = calling_scope->parent;
break;

case zephir_fcall_static:
fcic->calling_scope = fcic->called_scope;
#if PHP_VERSION_ID >= 80000
if (ce && Z_TYPE_P(func) == IS_STRING) {
fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func));
fcic->calling_scope = ce;
} else if (calling_scope && Z_TYPE_P(func) == IS_STRING) {
fcic->function_handler = zend_hash_find_ptr(&calling_scope->function_table, Z_STR_P(func));
fcic->calling_scope = called_scope;
}
#else
fcic->calling_scope = called_scope;
if (UNEXPECTED(!calling_scope)) {
return;
}
#endif

break;

case zephir_fcall_self:
fcic->calling_scope = calling_scope;
#if PHP_VERSION_ID >= 80000
if (ce && Z_TYPE_P(func) == IS_STRING) {
fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func));

fcic->calling_scope = ce;
} else if (calling_scope && Z_TYPE_P(func) == IS_STRING) {
fcic->function_handler = zend_hash_find_ptr(&calling_scope->function_table, Z_STR_P(func));
fcic->calling_scope = calling_scope;
}
#endif
break;

case zephir_fcall_ce:
#if PHP_VERSION_ID >= 80000
if (ce && Z_TYPE_P(func) == IS_STRING) {
fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func));

fcic->calling_scope = ce;
} else if (calling_scope && Z_TYPE_P(func) == IS_STRING) {
fcic->function_handler = zend_hash_find_ptr(&calling_scope->function_table, Z_STR_P(func));
fcic->calling_scope = calling_scope;
}
#endif
fcic->calling_scope = ce;
fcic->called_scope = ce;
break;
Expand All @@ -270,6 +313,11 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
return;
}

#if PHP_VERSION_ID >= 80000
if (ce && Z_TYPE_P(func) == IS_STRING) {
fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func));
}
#endif
fcic->calling_scope = this_ptr ? Z_OBJCE_P(this_ptr) : NULL;
fcic->called_scope = fcic->calling_scope;
break;
Expand Down Expand Up @@ -354,7 +402,9 @@ int zephir_call_user_function(zval *object_pp, zend_class_entry *obj_ce, zephir_
} else if ((cache_entry && !*cache_entry) || zephir_globals_ptr->cache_enabled) {
/* The caller is interested in caching OR we have the call cache enabled */
resolve_callable(&callable, type, (object_pp && type != zephir_fcall_ce ? Z_OBJCE_P(object_pp) : obj_ce), object_pp, function_name);
zend_is_callable_ex(&callable, fci.object, IS_CALLABLE_CHECK_SILENT, NULL, &fcic, NULL);
if (obj_ce || !zend_is_callable_ex(&callable, fci.object, IS_CALLABLE_CHECK_SILENT, NULL, &fcic, NULL)) {
populate_fcic(&fcic, type, obj_ce, object_pp, function_name, called_scope);
}
}

#ifdef _MSC_VER
Expand All @@ -368,9 +418,6 @@ int zephir_call_user_function(zval *object_pp, zend_class_entry *obj_ce, zephir_
}

fci.params = p;
if (!fcic.function_handler) {
ZVAL_COPY_VALUE(&fci.function_name, &callable);
}
status = zend_call_function(&fci, &fcic);
#ifdef _MSC_VER
efree(p);
Expand Down
17 changes: 0 additions & 17 deletions kernels/ZendEngine3/fcall.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -212,35 +212,18 @@ typedef enum _zephir_call_type {
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, class_entry, zephir_fcall_parent, this_ptr, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} while (0)

#if PHP_VERSION_ID >= 80000
#define ZEPHIR_CALL_SELF(return_value_ptr, method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \
ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, getThis(), zephir_fcall_self, (getThis() ? Z_OBJCE_P(getThis()) : NULL), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} while (0)
#else
#define ZEPHIR_CALL_SELF(return_value_ptr, method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \
ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, NULL, zephir_fcall_self, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} while (0)
#endif

#if PHP_VERSION_ID >= 80000
#define ZEPHIR_RETURN_CALL_SELF(method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_self, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} while (0)
#else
#define ZEPHIR_RETURN_CALL_SELF(method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, NULL, zephir_fcall_self, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} while (0)
#endif

#define ZEPHIR_CALL_STATIC(return_value_ptr, method, cache, cache_slot, ...) \
do { \
Expand Down
Empty file modified kernels/ZendEngine3/file.c
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/file.h
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/filter.c
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/filter.h
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/globals.h
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/iterator.c
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/iterator.h
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/main.c
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/main.h
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/math.c
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/math.h
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/memory.c
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/memory.h
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/object.c
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/object.h
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/operators.c
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/operators.h
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/require.c
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/require.h
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/string.c
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/string.h
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/time.c
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/time.h
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/variables.c
100644 → 100755
Empty file.
Empty file modified kernels/ZendEngine3/variables.h
100644 → 100755
Empty file.

0 comments on commit a9abeba

Please sign in to comment.