1999-04-08 02:10:10 +08:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Zend Engine |
|
|
|
|
+----------------------------------------------------------------------+
|
2019-01-30 17:23:29 +08:00
|
|
|
| Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
|
1999-04-08 02:10:10 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2001-12-11 23:16:21 +08:00
|
|
|
| This source file is subject to version 2.00 of the Zend license, |
|
2012-10-05 14:14:20 +08:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
2003-06-11 04:04:29 +08:00
|
|
|
| available through the world-wide-web at the following url: |
|
2001-12-11 23:16:21 +08:00
|
|
|
| http://www.zend.com/license/2_00.txt. |
|
1999-07-16 22:58:16 +08:00
|
|
|
| If you did not receive a copy of the Zend license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@zend.com so we can mail you a copy immediately. |
|
1999-04-08 02:10:10 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2018-11-01 23:20:07 +08:00
|
|
|
| Authors: Andi Gutmans <andi@php.net> |
|
|
|
|
| Zeev Suraski <zeev@php.net> |
|
|
|
|
| Dmitry Stogov <dmitry@php.net> |
|
1999-04-08 02:10:10 +08:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
2000-07-03 08:55:36 +08:00
|
|
|
#ifndef ZEND_EXECUTE_H
|
|
|
|
#define ZEND_EXECUTE_H
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2023-01-16 19:27:33 +08:00
|
|
|
#include "zend_compile.h"
|
|
|
|
#include "zend_hash.h"
|
|
|
|
#include "zend_operators.h"
|
|
|
|
#include "zend_variables.h"
|
2023-01-16 19:22:54 +08:00
|
|
|
|
2023-02-23 22:56:54 +08:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2002-05-20 15:17:30 +08:00
|
|
|
BEGIN_EXTERN_C()
|
2012-10-05 14:14:20 +08:00
|
|
|
struct _zend_fcall_info;
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API extern void (*zend_execute_ex)(zend_execute_data *execute_data);
|
|
|
|
ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data, zval *return_value);
|
|
|
|
|
2020-06-09 23:36:36 +08:00
|
|
|
/* The lc_name may be stack allocated! */
|
|
|
|
ZEND_API extern zend_class_entry *(*zend_autoload)(zend_string *name, zend_string *lc_name);
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
void init_executor(void);
|
|
|
|
void shutdown_executor(void);
|
|
|
|
void shutdown_destructors(void);
|
2021-08-16 21:40:10 +08:00
|
|
|
ZEND_API void zend_shutdown_executor_values(bool fast_shutdown);
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API void zend_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value);
|
2017-06-29 15:10:57 +08:00
|
|
|
ZEND_API void zend_init_func_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value);
|
|
|
|
ZEND_API void zend_init_code_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value);
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value);
|
|
|
|
ZEND_API void execute_ex(zend_execute_data *execute_data);
|
|
|
|
ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_value);
|
2021-01-15 19:30:54 +08:00
|
|
|
ZEND_API bool zend_is_valid_class_name(zend_string *name);
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API zend_class_entry *zend_lookup_class(zend_string *name);
|
2019-05-24 20:41:38 +08:00
|
|
|
ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *lcname, uint32_t flags);
|
2015-04-23 17:16:37 +08:00
|
|
|
ZEND_API zend_class_entry *zend_get_called_scope(zend_execute_data *ex);
|
|
|
|
ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex);
|
2020-08-28 21:41:27 +08:00
|
|
|
ZEND_API zend_result zend_eval_string(const char *str, zval *retval_ptr, const char *string_name);
|
|
|
|
ZEND_API zend_result zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name);
|
|
|
|
ZEND_API zend_result zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, bool handle_exceptions);
|
|
|
|
ZEND_API zend_result zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ptr, const char *string_name, bool handle_exceptions);
|
2014-12-14 06:06:14 +08:00
|
|
|
|
2016-05-01 02:46:52 +08:00
|
|
|
/* export zend_pass_function to allow comparisons against it */
|
|
|
|
extern ZEND_API const zend_internal_function zend_pass_function;
|
|
|
|
|
2016-06-16 07:32:02 +08:00
|
|
|
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_missing_arg_error(zend_execute_data *execute_data);
|
2020-04-24 16:58:10 +08:00
|
|
|
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_deprecated_function(const zend_function *fbc);
|
2024-07-02 15:44:25 +08:00
|
|
|
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_deprecated_class_constant(const zend_class_constant *c, const zend_string *constant_name);
|
2021-06-10 04:50:54 +08:00
|
|
|
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_false_to_array_deprecated(void);
|
2020-07-06 16:37:46 +08:00
|
|
|
ZEND_COLD void ZEND_FASTCALL zend_param_must_be_ref(const zend_function *func, uint32_t arg_num);
|
2021-08-31 16:58:01 +08:00
|
|
|
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_use_resource_as_offset(const zval *dim);
|
2024-10-04 01:38:16 +08:00
|
|
|
ZEND_API zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_call_stack_size_error(void);
|
2014-12-14 06:06:14 +08:00
|
|
|
|
2021-01-15 19:30:54 +08:00
|
|
|
ZEND_API bool ZEND_FASTCALL zend_verify_ref_assignable_zval(zend_reference *ref, zval *zv, bool strict);
|
2022-08-26 22:33:47 +08:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
ZEND_VERIFY_PROP_ASSIGNABLE_BY_REF_CONTEXT_ASSIGNMENT,
|
|
|
|
ZEND_VERIFY_PROP_ASSIGNABLE_BY_REF_CONTEXT_MAGIC_GET,
|
|
|
|
} zend_verify_prop_assignable_by_ref_context;
|
2023-01-03 23:38:56 +08:00
|
|
|
ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref_ex(const zend_property_info *prop_info, zval *orig_val, bool strict, zend_verify_prop_assignable_by_ref_context context);
|
|
|
|
ZEND_API bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref(const zend_property_info *prop_info, zval *orig_val, bool strict);
|
2019-01-07 19:28:51 +08:00
|
|
|
|
2023-01-03 23:38:56 +08:00
|
|
|
ZEND_API ZEND_COLD void zend_throw_ref_type_error_zval(const zend_property_info *prop, const zval *zv);
|
|
|
|
ZEND_API ZEND_COLD void zend_throw_ref_type_error_type(const zend_property_info *prop1, const zend_property_info *prop2, const zval *zv);
|
2021-06-23 19:55:58 +08:00
|
|
|
ZEND_API ZEND_COLD zval* ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, zend_long lval);
|
|
|
|
ZEND_API ZEND_COLD zval* ZEND_FASTCALL zend_undefined_index_write(HashTable *ht, zend_string *offset);
|
2021-10-05 22:31:53 +08:00
|
|
|
ZEND_API ZEND_COLD void zend_wrong_string_offset_error(void);
|
2019-01-07 19:28:51 +08:00
|
|
|
|
2023-01-03 23:38:56 +08:00
|
|
|
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_readonly_property_modification_error(const zend_property_info *info);
|
2024-07-16 22:29:40 +08:00
|
|
|
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_readonly_property_modification_error_ex(const char *class_name, const char *prop_name);
|
2023-01-03 23:38:56 +08:00
|
|
|
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_readonly_property_indirect_modification_error(const zend_property_info *info);
|
2021-06-02 16:02:56 +08:00
|
|
|
|
2023-02-23 22:56:54 +08:00
|
|
|
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_invalid_class_constant_type_error(uint8_t type);
|
2023-02-02 22:40:50 +08:00
|
|
|
|
2022-12-29 03:30:51 +08:00
|
|
|
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_object_released_while_assigning_to_property_error(const zend_property_info *info);
|
|
|
|
|
2023-05-23 18:10:27 +08:00
|
|
|
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_cannot_add_element(void);
|
|
|
|
|
2024-08-27 08:04:48 +08:00
|
|
|
ZEND_API bool ZEND_FASTCALL zend_asymmetric_property_has_set_access(const zend_property_info *prop_info);
|
|
|
|
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_asymmetric_visibility_property_modification_error(const zend_property_info *info, const char *operation);
|
|
|
|
|
2021-01-15 19:30:54 +08:00
|
|
|
ZEND_API bool zend_verify_scalar_type_hint(uint32_t type_mask, zval *arg, bool strict, bool is_internal_arg);
|
2019-09-19 18:11:29 +08:00
|
|
|
ZEND_API ZEND_COLD void zend_verify_arg_error(
|
2021-03-25 10:12:06 +08:00
|
|
|
const zend_function *zf, const zend_arg_info *arg_info, uint32_t arg_num, zval *value);
|
2019-12-06 22:02:15 +08:00
|
|
|
ZEND_API ZEND_COLD void zend_verify_return_error(
|
2020-08-28 23:15:09 +08:00
|
|
|
const zend_function *zf, zval *value);
|
2021-04-19 17:23:30 +08:00
|
|
|
ZEND_API ZEND_COLD void zend_verify_never_error(
|
|
|
|
const zend_function *zf);
|
2021-01-15 19:30:54 +08:00
|
|
|
ZEND_API bool zend_verify_ref_array_assignable(zend_reference *ref);
|
2021-07-05 20:11:03 +08:00
|
|
|
ZEND_API bool zend_check_user_type_slow(
|
|
|
|
zend_type *type, zval *arg, zend_reference *ref, void **cache_slot, bool is_return_type);
|
2020-01-07 22:06:36 +08:00
|
|
|
|
2021-07-13 17:41:33 +08:00
|
|
|
#if ZEND_DEBUG
|
|
|
|
ZEND_API bool zend_internal_call_should_throw(zend_function *fbc, zend_execute_data *call);
|
|
|
|
ZEND_API ZEND_COLD void zend_internal_call_arginfo_violation(zend_function *fbc);
|
|
|
|
ZEND_API bool zend_verify_internal_return_type(zend_function *zf, zval *ret);
|
|
|
|
#endif
|
2019-09-19 18:11:29 +08:00
|
|
|
|
2019-01-07 19:28:51 +08:00
|
|
|
#define ZEND_REF_TYPE_SOURCES(ref) \
|
|
|
|
(ref)->sources
|
|
|
|
|
|
|
|
#define ZEND_REF_HAS_TYPE_SOURCES(ref) \
|
|
|
|
(ZEND_REF_TYPE_SOURCES(ref).ptr != NULL)
|
|
|
|
|
|
|
|
#define ZEND_REF_FIRST_SOURCE(ref) \
|
|
|
|
(ZEND_PROPERTY_INFO_SOURCE_IS_LIST((ref)->sources.list) \
|
|
|
|
? ZEND_PROPERTY_INFO_SOURCE_TO_LIST((ref)->sources.list)->ptr[0] \
|
|
|
|
: (ref)->sources.ptr)
|
|
|
|
|
|
|
|
|
2019-01-15 16:14:33 +08:00
|
|
|
ZEND_API void ZEND_FASTCALL zend_ref_add_type_source(zend_property_info_source_list *source_list, zend_property_info *prop);
|
2023-01-03 23:38:56 +08:00
|
|
|
ZEND_API void ZEND_FASTCALL zend_ref_del_type_source(zend_property_info_source_list *source_list, const zend_property_info *prop);
|
2019-01-07 19:28:51 +08:00
|
|
|
|
2023-02-23 22:56:54 +08:00
|
|
|
ZEND_API zval* zend_assign_to_typed_ref(zval *variable_ptr, zval *value, uint8_t value_type, bool strict);
|
2023-02-17 04:10:14 +08:00
|
|
|
ZEND_API zval* zend_assign_to_typed_ref_ex(zval *variable_ptr, zval *value, uint8_t value_type, bool strict, zend_refcounted **garbage_ptr);
|
2019-05-29 18:58:37 +08:00
|
|
|
|
2023-02-23 22:56:54 +08:00
|
|
|
static zend_always_inline void zend_copy_to_variable(zval *variable_ptr, zval *value, uint8_t value_type)
|
2019-05-29 18:58:37 +08:00
|
|
|
{
|
2020-06-05 19:20:39 +08:00
|
|
|
zend_refcounted *ref = NULL;
|
|
|
|
|
|
|
|
if (ZEND_CONST_COND(value_type & (IS_VAR|IS_CV), 1) && Z_ISREF_P(value)) {
|
|
|
|
ref = Z_COUNTED_P(value);
|
|
|
|
value = Z_REFVAL_P(value);
|
|
|
|
}
|
|
|
|
|
2019-05-29 18:58:37 +08:00
|
|
|
ZVAL_COPY_VALUE(variable_ptr, value);
|
|
|
|
if (ZEND_CONST_COND(value_type == IS_CONST, 0)) {
|
|
|
|
if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
|
|
|
|
Z_ADDREF_P(variable_ptr);
|
|
|
|
}
|
|
|
|
} else if (value_type & (IS_CONST|IS_CV)) {
|
|
|
|
if (Z_OPT_REFCOUNTED_P(variable_ptr)) {
|
|
|
|
Z_ADDREF_P(variable_ptr);
|
|
|
|
}
|
|
|
|
} else if (ZEND_CONST_COND(value_type == IS_VAR, 1) && UNEXPECTED(ref)) {
|
|
|
|
if (UNEXPECTED(GC_DELREF(ref) == 0)) {
|
|
|
|
efree_size(ref, sizeof(zend_reference));
|
|
|
|
} else if (Z_OPT_REFCOUNTED_P(variable_ptr)) {
|
|
|
|
Z_ADDREF_P(variable_ptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-23 22:56:54 +08:00
|
|
|
static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value, uint8_t value_type, bool strict)
|
2014-11-25 01:33:27 +08:00
|
|
|
{
|
|
|
|
do {
|
2015-01-03 17:22:58 +08:00
|
|
|
if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr))) {
|
2023-02-16 21:07:17 +08:00
|
|
|
zend_refcounted *garbage;
|
|
|
|
|
2014-11-25 01:33:27 +08:00
|
|
|
if (Z_ISREF_P(variable_ptr)) {
|
2019-01-07 19:28:51 +08:00
|
|
|
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(variable_ptr)))) {
|
2020-06-05 19:20:39 +08:00
|
|
|
return zend_assign_to_typed_ref(variable_ptr, value, value_type, strict);
|
2019-01-07 19:28:51 +08:00
|
|
|
}
|
|
|
|
|
2014-11-25 01:33:27 +08:00
|
|
|
variable_ptr = Z_REFVAL_P(variable_ptr);
|
|
|
|
if (EXPECTED(!Z_REFCOUNTED_P(variable_ptr))) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2023-02-16 21:07:17 +08:00
|
|
|
garbage = Z_COUNTED_P(variable_ptr);
|
2020-06-05 19:20:39 +08:00
|
|
|
zend_copy_to_variable(variable_ptr, value, value_type);
|
2023-03-03 19:13:27 +08:00
|
|
|
GC_DTOR_NO_REF(garbage);
|
2019-04-09 20:37:19 +08:00
|
|
|
return variable_ptr;
|
2014-11-25 01:33:27 +08:00
|
|
|
}
|
|
|
|
} while (0);
|
|
|
|
|
2020-06-05 19:20:39 +08:00
|
|
|
zend_copy_to_variable(variable_ptr, value, value_type);
|
2014-11-25 01:33:27 +08:00
|
|
|
return variable_ptr;
|
|
|
|
}
|
|
|
|
|
2023-02-17 05:33:37 +08:00
|
|
|
static zend_always_inline zval* zend_assign_to_variable_ex(zval *variable_ptr, zval *value, zend_uchar value_type, bool strict, zend_refcounted **garbage_ptr)
|
|
|
|
{
|
|
|
|
do {
|
|
|
|
if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr))) {
|
|
|
|
if (Z_ISREF_P(variable_ptr)) {
|
|
|
|
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(variable_ptr)))) {
|
2023-02-17 04:10:14 +08:00
|
|
|
return zend_assign_to_typed_ref_ex(variable_ptr, value, value_type, strict, garbage_ptr);
|
2023-02-17 05:33:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
variable_ptr = Z_REFVAL_P(variable_ptr);
|
|
|
|
if (EXPECTED(!Z_REFCOUNTED_P(variable_ptr))) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*garbage_ptr = Z_COUNTED_P(variable_ptr);
|
|
|
|
}
|
|
|
|
} while (0);
|
|
|
|
|
|
|
|
zend_copy_to_variable(variable_ptr, value, value_type);
|
|
|
|
return variable_ptr;
|
|
|
|
}
|
|
|
|
|
2020-10-08 07:04:38 +08:00
|
|
|
ZEND_API zend_result ZEND_FASTCALL zval_update_constant(zval *pp);
|
|
|
|
ZEND_API zend_result ZEND_FASTCALL zval_update_constant_ex(zval *pp, zend_class_entry *scope);
|
2022-11-11 22:55:03 +08:00
|
|
|
ZEND_API zend_result ZEND_FASTCALL zval_update_constant_with_ctx(zval *pp, zend_class_entry *scope, zend_ast_evaluate_ctx *ctx);
|
1999-04-08 02:10:10 +08:00
|
|
|
|
1999-04-13 02:29:09 +08:00
|
|
|
/* dedicated Zend executor functions - do not use! */
|
2008-01-24 17:41:39 +08:00
|
|
|
struct _zend_vm_stack {
|
2014-02-10 14:04:30 +08:00
|
|
|
zval *top;
|
|
|
|
zval *end;
|
2008-01-24 17:41:39 +08:00
|
|
|
zend_vm_stack prev;
|
|
|
|
};
|
|
|
|
|
2023-04-04 18:09:38 +08:00
|
|
|
/* Ensure the correct alignment before slots calculation */
|
|
|
|
ZEND_STATIC_ASSERT(ZEND_MM_ALIGNED_SIZE(sizeof(zval)) == sizeof(zval),
|
|
|
|
"zval must be aligned by ZEND_MM_ALIGNMENT");
|
|
|
|
/* A number of call frame slots (zvals) reserved for _zend_vm_stack. */
|
2014-09-29 23:41:00 +08:00
|
|
|
#define ZEND_VM_STACK_HEADER_SLOTS \
|
2023-04-04 18:09:38 +08:00
|
|
|
((sizeof(struct _zend_vm_stack) + sizeof(zval) - 1) / sizeof(zval))
|
2014-06-27 03:51:14 +08:00
|
|
|
|
2015-12-11 02:17:24 +08:00
|
|
|
#define ZEND_VM_STACK_ELEMENTS(stack) \
|
2014-09-29 23:41:00 +08:00
|
|
|
(((zval*)(stack)) + ZEND_VM_STACK_HEADER_SLOTS)
|
|
|
|
|
2015-06-22 21:39:07 +08:00
|
|
|
/*
|
|
|
|
* In general in RELEASE build ZEND_ASSERT() must be zero-cost, but for some
|
|
|
|
* reason, GCC generated worse code, performing CSE on assertion code and the
|
2021-03-31 11:49:41 +08:00
|
|
|
* following "slow path" and moving memory read operations from slow path into
|
2015-06-22 21:39:07 +08:00
|
|
|
* common header. This made a degradation for the fast path.
|
|
|
|
* The following "#if ZEND_DEBUG" eliminates it.
|
|
|
|
*/
|
2015-06-22 18:08:33 +08:00
|
|
|
#if ZEND_DEBUG
|
|
|
|
# define ZEND_ASSERT_VM_STACK(stack) ZEND_ASSERT(stack->top > (zval *) stack && stack->end > (zval *) stack && stack->top <= stack->end)
|
|
|
|
# define ZEND_ASSERT_VM_STACK_GLOBAL ZEND_ASSERT(EG(vm_stack_top) > (zval *) EG(vm_stack) && EG(vm_stack_end) > (zval *) EG(vm_stack) && EG(vm_stack_top) <= EG(vm_stack_end))
|
|
|
|
#else
|
|
|
|
# define ZEND_ASSERT_VM_STACK(stack)
|
|
|
|
# define ZEND_ASSERT_VM_STACK_GLOBAL
|
|
|
|
#endif
|
2015-06-21 00:28:51 +08:00
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API void zend_vm_stack_init(void);
|
2018-12-26 18:09:32 +08:00
|
|
|
ZEND_API void zend_vm_stack_init_ex(size_t page_size);
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API void zend_vm_stack_destroy(void);
|
|
|
|
ZEND_API void* zend_vm_stack_extend(size_t size);
|
2014-09-29 23:41:00 +08:00
|
|
|
|
2021-06-10 21:20:29 +08:00
|
|
|
static zend_always_inline zend_vm_stack zend_vm_stack_new_page(size_t size, zend_vm_stack prev) {
|
|
|
|
zend_vm_stack page = (zend_vm_stack)emalloc(size);
|
|
|
|
|
|
|
|
page->top = ZEND_VM_STACK_ELEMENTS(page);
|
|
|
|
page->end = (zval*)((char*)page + size);
|
|
|
|
page->prev = prev;
|
|
|
|
return page;
|
|
|
|
}
|
|
|
|
|
2019-04-11 07:08:32 +08:00
|
|
|
static zend_always_inline void zend_vm_init_call_frame(zend_execute_data *call, uint32_t call_info, zend_function *func, uint32_t num_args, void *object_or_called_scope)
|
2016-04-01 21:17:49 +08:00
|
|
|
{
|
2021-07-23 17:26:39 +08:00
|
|
|
ZEND_ASSERT(!func->common.scope || object_or_called_scope);
|
2016-04-01 21:17:49 +08:00
|
|
|
call->func = func;
|
2019-04-11 07:08:32 +08:00
|
|
|
Z_PTR(call->This) = object_or_called_scope;
|
|
|
|
ZEND_CALL_INFO(call) = call_info;
|
2016-04-01 21:17:49 +08:00
|
|
|
ZEND_CALL_NUM_ARGS(call) = num_args;
|
|
|
|
}
|
|
|
|
|
2019-04-11 07:08:32 +08:00
|
|
|
static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame_ex(uint32_t used_stack, uint32_t call_info, zend_function *func, uint32_t num_args, void *object_or_called_scope)
|
2014-06-24 06:17:16 +08:00
|
|
|
{
|
2015-05-12 20:56:42 +08:00
|
|
|
zend_execute_data *call = (zend_execute_data*)EG(vm_stack_top);
|
2014-12-12 14:01:42 +08:00
|
|
|
|
2015-06-21 00:28:51 +08:00
|
|
|
ZEND_ASSERT_VM_STACK_GLOBAL;
|
|
|
|
|
2015-05-12 20:56:42 +08:00
|
|
|
if (UNEXPECTED(used_stack > (size_t)(((char*)EG(vm_stack_end)) - (char*)call))) {
|
|
|
|
call = (zend_execute_data*)zend_vm_stack_extend(used_stack);
|
2016-04-01 21:17:49 +08:00
|
|
|
ZEND_ASSERT_VM_STACK_GLOBAL;
|
2019-04-11 07:08:32 +08:00
|
|
|
zend_vm_init_call_frame(call, call_info | ZEND_CALL_ALLOCATED, func, num_args, object_or_called_scope);
|
2016-04-01 21:17:49 +08:00
|
|
|
return call;
|
2015-05-12 20:56:42 +08:00
|
|
|
} else {
|
|
|
|
EG(vm_stack_top) = (zval*)((char*)call + used_stack);
|
2019-04-11 07:08:32 +08:00
|
|
|
zend_vm_init_call_frame(call, call_info, func, num_args, object_or_called_scope);
|
2016-04-01 21:17:49 +08:00
|
|
|
return call;
|
2015-05-12 20:56:42 +08:00
|
|
|
}
|
2014-06-24 06:17:16 +08:00
|
|
|
}
|
|
|
|
|
2014-12-12 14:01:42 +08:00
|
|
|
static zend_always_inline uint32_t zend_vm_calc_used_stack(uint32_t num_args, zend_function *func)
|
|
|
|
{
|
Save previous observer on the VM stack
This avoids a possible significant performance penalty, when some leaf function was observed, deep in the stack.
As a side effect, we are not iterating over prev_execute_data anymore and thus, non-observed fake frames, possibly on stack, cannot have any impact on the observer anymore (especially within zend_observer_fcall_end_all).
Saving the previous observer happens now directly on the VM stack. If there is any observer, function frames are allocated an extra zval (the last temporary), which will, on observed frames, contain the previous observed frame address.
2022-07-28 22:50:26 +08:00
|
|
|
uint32_t used_stack = ZEND_CALL_FRAME_SLOT + num_args + func->common.T;
|
2015-01-03 17:22:58 +08:00
|
|
|
|
2015-05-07 22:26:35 +08:00
|
|
|
if (EXPECTED(ZEND_USER_CODE(func->type))) {
|
Save previous observer on the VM stack
This avoids a possible significant performance penalty, when some leaf function was observed, deep in the stack.
As a side effect, we are not iterating over prev_execute_data anymore and thus, non-observed fake frames, possibly on stack, cannot have any impact on the observer anymore (especially within zend_observer_fcall_end_all).
Saving the previous observer happens now directly on the VM stack. If there is any observer, function frames are allocated an extra zval (the last temporary), which will, on observed frames, contain the previous observed frame address.
2022-07-28 22:50:26 +08:00
|
|
|
used_stack += func->op_array.last_var - MIN(func->op_array.num_args, num_args);
|
2014-12-12 14:01:42 +08:00
|
|
|
}
|
|
|
|
return used_stack * sizeof(zval);
|
|
|
|
}
|
|
|
|
|
2019-04-11 07:08:32 +08:00
|
|
|
static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame(uint32_t call_info, zend_function *func, uint32_t num_args, void *object_or_called_scope)
|
2014-12-12 14:01:42 +08:00
|
|
|
{
|
|
|
|
uint32_t used_stack = zend_vm_calc_used_stack(num_args, func);
|
2015-01-03 17:22:58 +08:00
|
|
|
|
2014-12-16 23:40:52 +08:00
|
|
|
return zend_vm_stack_push_call_frame_ex(used_stack, call_info,
|
2019-04-11 07:08:32 +08:00
|
|
|
func, num_args, object_or_called_scope);
|
2014-12-12 14:01:42 +08:00
|
|
|
}
|
|
|
|
|
2015-04-16 17:16:03 +08:00
|
|
|
static zend_always_inline void zend_vm_stack_free_extra_args_ex(uint32_t call_info, zend_execute_data *call)
|
2012-10-05 14:14:20 +08:00
|
|
|
{
|
2015-04-16 19:46:54 +08:00
|
|
|
if (UNEXPECTED(call_info & ZEND_CALL_FREE_EXTRA_ARGS)) {
|
2017-12-14 08:39:22 +08:00
|
|
|
uint32_t count = ZEND_CALL_NUM_ARGS(call) - call->func->op_array.num_args;
|
2018-05-08 20:28:57 +08:00
|
|
|
zval *p = ZEND_CALL_VAR_NUM(call, call->func->op_array.last_var + call->func->op_array.T);
|
2014-06-27 03:51:14 +08:00
|
|
|
do {
|
2020-01-31 21:01:09 +08:00
|
|
|
i_zval_ptr_dtor(p);
|
2018-05-08 20:28:57 +08:00
|
|
|
p++;
|
2017-12-14 08:39:22 +08:00
|
|
|
} while (--count);
|
2014-06-27 03:51:14 +08:00
|
|
|
}
|
2009-09-03 22:33:11 +08:00
|
|
|
}
|
|
|
|
|
2015-04-16 17:16:03 +08:00
|
|
|
static zend_always_inline void zend_vm_stack_free_extra_args(zend_execute_data *call)
|
|
|
|
{
|
|
|
|
zend_vm_stack_free_extra_args_ex(ZEND_CALL_INFO(call), call);
|
|
|
|
}
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
static zend_always_inline void zend_vm_stack_free_args(zend_execute_data *call)
|
2000-06-14 01:58:33 +08:00
|
|
|
{
|
2014-11-28 15:28:49 +08:00
|
|
|
uint32_t num_args = ZEND_CALL_NUM_ARGS(call);
|
2000-06-14 01:58:33 +08:00
|
|
|
|
2014-12-17 17:16:02 +08:00
|
|
|
if (EXPECTED(num_args > 0)) {
|
2018-05-08 20:28:57 +08:00
|
|
|
zval *p = ZEND_CALL_ARG(call, 1);
|
2014-06-27 16:25:36 +08:00
|
|
|
|
2014-06-16 17:25:23 +08:00
|
|
|
do {
|
2020-01-31 21:01:09 +08:00
|
|
|
zval_ptr_dtor_nogc(p);
|
2018-05-08 20:28:57 +08:00
|
|
|
p++;
|
|
|
|
} while (--num_args);
|
2000-06-14 01:58:33 +08:00
|
|
|
}
|
2014-06-27 03:51:14 +08:00
|
|
|
}
|
|
|
|
|
2015-05-12 20:56:42 +08:00
|
|
|
static zend_always_inline void zend_vm_stack_free_call_frame_ex(uint32_t call_info, zend_execute_data *call)
|
2014-06-27 03:51:14 +08:00
|
|
|
{
|
2015-06-21 00:28:51 +08:00
|
|
|
ZEND_ASSERT_VM_STACK_GLOBAL;
|
|
|
|
|
2015-05-12 20:56:42 +08:00
|
|
|
if (UNEXPECTED(call_info & ZEND_CALL_ALLOCATED)) {
|
2016-05-12 21:46:37 +08:00
|
|
|
zend_vm_stack p = EG(vm_stack);
|
2014-10-10 00:29:02 +08:00
|
|
|
zend_vm_stack prev = p->prev;
|
|
|
|
|
2016-06-07 06:01:48 +08:00
|
|
|
ZEND_ASSERT(call == (zend_execute_data*)ZEND_VM_STACK_ELEMENTS(EG(vm_stack)));
|
2014-10-10 00:29:02 +08:00
|
|
|
EG(vm_stack_top) = prev->top;
|
|
|
|
EG(vm_stack_end) = prev->end;
|
|
|
|
EG(vm_stack) = prev;
|
2014-06-27 03:51:14 +08:00
|
|
|
efree(p);
|
2012-12-13 21:29:30 +08:00
|
|
|
} else {
|
2014-10-10 00:29:02 +08:00
|
|
|
EG(vm_stack_top) = (zval*)call;
|
2012-12-13 21:29:30 +08:00
|
|
|
}
|
2015-06-21 00:28:51 +08:00
|
|
|
|
|
|
|
ZEND_ASSERT_VM_STACK_GLOBAL;
|
2000-06-14 01:58:33 +08:00
|
|
|
}
|
|
|
|
|
2015-05-12 20:56:42 +08:00
|
|
|
static zend_always_inline void zend_vm_stack_free_call_frame(zend_execute_data *call)
|
|
|
|
{
|
|
|
|
zend_vm_stack_free_call_frame_ex(ZEND_CALL_INFO(call), call);
|
|
|
|
}
|
|
|
|
|
2020-04-06 18:46:52 +08:00
|
|
|
zend_execute_data *zend_vm_stack_copy_call_frame(
|
|
|
|
zend_execute_data *call, uint32_t passed_args, uint32_t additional_args);
|
|
|
|
|
|
|
|
static zend_always_inline void zend_vm_stack_extend_call_frame(
|
|
|
|
zend_execute_data **call, uint32_t passed_args, uint32_t additional_args)
|
|
|
|
{
|
|
|
|
if (EXPECTED((uint32_t)(EG(vm_stack_end) - EG(vm_stack_top)) > additional_args)) {
|
|
|
|
EG(vm_stack_top) += additional_args;
|
|
|
|
} else {
|
|
|
|
*call = zend_vm_stack_copy_call_frame(*call, passed_args, additional_args);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ZEND_API void ZEND_FASTCALL zend_free_extra_named_params(zend_array *extra_named_params);
|
|
|
|
|
1999-04-08 02:10:10 +08:00
|
|
|
/* services */
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API const char *get_active_class_name(const char **space);
|
|
|
|
ZEND_API const char *get_active_function_name(void);
|
2020-01-30 03:06:13 +08:00
|
|
|
ZEND_API const char *get_active_function_arg_name(uint32_t arg_num);
|
|
|
|
ZEND_API const char *get_function_arg_name(const zend_function *func, uint32_t arg_num);
|
2024-02-07 00:02:00 +08:00
|
|
|
ZEND_API zend_function *zend_active_function_ex(zend_execute_data *execute_data);
|
|
|
|
|
|
|
|
static zend_always_inline zend_function *zend_active_function(void)
|
|
|
|
{
|
|
|
|
zend_function *func = EG(current_execute_data)->func;
|
|
|
|
if (ZEND_USER_CODE(func->type)) {
|
|
|
|
return zend_active_function_ex(EG(current_execute_data));
|
|
|
|
} else {
|
|
|
|
return func;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-13 01:09:02 +08:00
|
|
|
ZEND_API zend_string *get_active_function_or_method_name(void);
|
2020-08-17 03:49:20 +08:00
|
|
|
ZEND_API zend_string *get_function_or_method_name(const zend_function *func);
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API const char *zend_get_executed_filename(void);
|
2015-03-05 23:18:39 +08:00
|
|
|
ZEND_API zend_string *zend_get_executed_filename_ex(void);
|
2016-11-26 22:18:42 +08:00
|
|
|
ZEND_API uint32_t zend_get_executed_lineno(void);
|
2016-04-28 09:13:34 +08:00
|
|
|
ZEND_API zend_class_entry *zend_get_executed_scope(void);
|
2021-01-15 19:30:54 +08:00
|
|
|
ZEND_API bool zend_is_executing(void);
|
2020-09-10 21:55:08 +08:00
|
|
|
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_cannot_pass_by_reference(uint32_t arg_num);
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2020-08-28 21:41:27 +08:00
|
|
|
ZEND_API void zend_set_timeout(zend_long seconds, bool reset_signals);
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API void zend_unset_timeout(void);
|
2020-05-07 04:22:07 +08:00
|
|
|
ZEND_API ZEND_NORETURN void ZEND_FASTCALL zend_timeout(void);
|
2022-07-29 04:03:09 +08:00
|
|
|
ZEND_API zend_class_entry *zend_fetch_class(zend_string *class_name, uint32_t fetch_type);
|
|
|
|
ZEND_API zend_class_entry *zend_fetch_class_with_scope(zend_string *class_name, uint32_t fetch_type, zend_class_entry *scope);
|
|
|
|
ZEND_API zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, zend_string *lcname, uint32_t fetch_type);
|
2000-06-16 22:27:28 +08:00
|
|
|
|
2018-06-26 00:53:58 +08:00
|
|
|
ZEND_API zend_function * ZEND_FASTCALL zend_fetch_function(zend_string *name);
|
2018-06-26 04:01:21 +08:00
|
|
|
ZEND_API zend_function * ZEND_FASTCALL zend_fetch_function_str(const char *name, size_t len);
|
2019-12-09 20:58:00 +08:00
|
|
|
ZEND_API void ZEND_FASTCALL zend_init_func_run_time_cache(zend_op_array *op_array);
|
2018-06-26 00:53:58 +08:00
|
|
|
|
2017-06-16 03:50:04 +08:00
|
|
|
ZEND_API void zend_fetch_dimension_const(zval *result, zval *container, zval *dim, int type);
|
2014-04-12 00:21:46 +08:00
|
|
|
|
2014-08-26 01:28:33 +08:00
|
|
|
ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute_data_ptr, uint32_t var);
|
2005-01-22 10:29:18 +08:00
|
|
|
|
2022-06-08 19:32:30 +08:00
|
|
|
ZEND_API bool zend_gcc_global_regs(void);
|
|
|
|
|
2005-06-10 17:54:38 +08:00
|
|
|
#define ZEND_USER_OPCODE_CONTINUE 0 /* execute next opcode */
|
|
|
|
#define ZEND_USER_OPCODE_RETURN 1 /* exit from executor (return from function) */
|
|
|
|
#define ZEND_USER_OPCODE_DISPATCH 2 /* call original opcode handler */
|
2009-08-18 18:12:32 +08:00
|
|
|
#define ZEND_USER_OPCODE_ENTER 3 /* enter into new op_array without recursion */
|
|
|
|
#define ZEND_USER_OPCODE_LEAVE 4 /* return to calling op_array within the same executor */
|
2005-06-10 17:54:38 +08:00
|
|
|
|
2005-06-16 14:00:48 +08:00
|
|
|
#define ZEND_USER_OPCODE_DISPATCH_TO 0x100 /* call original handler of returned opcode */
|
|
|
|
|
2023-04-19 22:59:20 +08:00
|
|
|
ZEND_API zend_result zend_set_user_opcode_handler(uint8_t opcode, user_opcode_handler_t handler);
|
2023-02-23 22:56:54 +08:00
|
|
|
ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(uint8_t opcode);
|
2005-06-10 17:54:38 +08:00
|
|
|
|
2020-07-15 15:51:14 +08:00
|
|
|
ZEND_API zval *zend_get_zval_ptr(const zend_op *opline, int op_type, const znode_op *node, const zend_execute_data *execute_data);
|
2005-06-16 19:50:08 +08:00
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table);
|
2021-06-16 21:44:27 +08:00
|
|
|
ZEND_API void ZEND_FASTCALL zend_free_compiled_variables(zend_execute_data *execute_data);
|
2022-11-04 22:55:55 +08:00
|
|
|
ZEND_API void zend_unfinished_calls_gc(zend_execute_data *execute_data, zend_execute_data *call, uint32_t op_num, zend_get_gc_buffer *buf);
|
2017-11-22 20:36:09 +08:00
|
|
|
ZEND_API void zend_cleanup_unfinished_execution(zend_execute_data *execute_data, uint32_t op_num, uint32_t catch_op_num);
|
2023-02-11 01:07:34 +08:00
|
|
|
ZEND_API ZEND_ATTRIBUTE_DEPRECATED HashTable *zend_unfinished_execution_gc(zend_execute_data *execute_data, zend_execute_data *call, zend_get_gc_buffer *gc_buffer);
|
|
|
|
ZEND_API HashTable *zend_unfinished_execution_gc_ex(zend_execute_data *execute_data, zend_execute_data *call, zend_get_gc_buffer *gc_buffer, bool suspended_by_yield);
|
2024-10-03 02:02:33 +08:00
|
|
|
ZEND_API zval* ZEND_FASTCALL zend_fetch_static_property(zend_execute_data *ex, int fetch_type);
|
2024-10-07 20:28:23 +08:00
|
|
|
ZEND_API void ZEND_FASTCALL zend_non_static_method_call(const zend_function *fbc);
|
2012-05-28 12:43:18 +08:00
|
|
|
|
2024-06-15 20:42:27 +08:00
|
|
|
ZEND_API void zend_frameless_observed_call(zend_execute_data *execute_data);
|
|
|
|
|
2020-04-06 18:46:52 +08:00
|
|
|
zval * ZEND_FASTCALL zend_handle_named_arg(
|
|
|
|
zend_execute_data **call_ptr, zend_string *arg_name,
|
|
|
|
uint32_t *arg_num_ptr, void **cache_slot);
|
2023-04-19 22:59:20 +08:00
|
|
|
ZEND_API zend_result ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *call);
|
2020-04-06 18:46:52 +08:00
|
|
|
|
2015-02-25 06:52:35 +08:00
|
|
|
#define CACHE_ADDR(num) \
|
2019-05-15 16:06:26 +08:00
|
|
|
((void**)((char*)EX(run_time_cache) + (num)))
|
2015-02-25 06:52:35 +08:00
|
|
|
|
2010-05-24 22:11:39 +08:00
|
|
|
#define CACHED_PTR(num) \
|
2019-05-15 16:06:26 +08:00
|
|
|
((void**)((char*)EX(run_time_cache) + (num)))[0]
|
2010-05-24 22:11:39 +08:00
|
|
|
|
|
|
|
#define CACHE_PTR(num, ptr) do { \
|
2019-05-15 16:06:26 +08:00
|
|
|
((void**)((char*)EX(run_time_cache) + (num)))[0] = (ptr); \
|
2010-05-24 22:11:39 +08:00
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define CACHED_POLYMORPHIC_PTR(num, ce) \
|
2019-05-15 16:06:26 +08:00
|
|
|
(EXPECTED(((void**)((char*)EX(run_time_cache) + (num)))[0] == (void*)(ce)) ? \
|
|
|
|
((void**)((char*)EX(run_time_cache) + (num)))[1] : \
|
2010-05-24 22:11:39 +08:00
|
|
|
NULL)
|
|
|
|
|
|
|
|
#define CACHE_POLYMORPHIC_PTR(num, ce, ptr) do { \
|
2019-05-15 16:06:26 +08:00
|
|
|
void **slot = (void**)((char*)EX(run_time_cache) + (num)); \
|
2015-02-25 06:52:35 +08:00
|
|
|
slot[0] = (ce); \
|
|
|
|
slot[1] = (ptr); \
|
2014-04-17 20:36:04 +08:00
|
|
|
} while (0)
|
|
|
|
|
2014-07-08 00:54:31 +08:00
|
|
|
#define CACHED_PTR_EX(slot) \
|
|
|
|
(slot)[0]
|
2014-04-17 20:36:04 +08:00
|
|
|
|
2014-07-08 00:54:31 +08:00
|
|
|
#define CACHE_PTR_EX(slot, ptr) do { \
|
|
|
|
(slot)[0] = (ptr); \
|
2014-04-17 20:36:04 +08:00
|
|
|
} while (0)
|
|
|
|
|
2014-07-08 00:54:31 +08:00
|
|
|
#define CACHED_POLYMORPHIC_PTR_EX(slot, ce) \
|
2015-05-07 22:26:35 +08:00
|
|
|
(EXPECTED((slot)[0] == (ce)) ? (slot)[1] : NULL)
|
2014-04-17 20:36:04 +08:00
|
|
|
|
2014-07-08 00:54:31 +08:00
|
|
|
#define CACHE_POLYMORPHIC_PTR_EX(slot, ce, ptr) do { \
|
|
|
|
(slot)[0] = (ce); \
|
|
|
|
(slot)[1] = (ptr); \
|
2010-05-24 22:11:39 +08:00
|
|
|
} while (0)
|
|
|
|
|
2018-03-30 21:41:02 +08:00
|
|
|
#define CACHE_SPECIAL (1<<0)
|
|
|
|
|
|
|
|
#define IS_SPECIAL_CACHE_VAL(ptr) \
|
|
|
|
(((uintptr_t)(ptr)) & CACHE_SPECIAL)
|
|
|
|
|
|
|
|
#define ENCODE_SPECIAL_CACHE_NUM(num) \
|
|
|
|
((void*)((((uintptr_t)(num)) << 1) | CACHE_SPECIAL))
|
|
|
|
|
|
|
|
#define DECODE_SPECIAL_CACHE_NUM(ptr) \
|
|
|
|
(((uintptr_t)(ptr)) >> 1)
|
|
|
|
|
|
|
|
#define ENCODE_SPECIAL_CACHE_PTR(ptr) \
|
|
|
|
((void*)(((uintptr_t)(ptr)) | CACHE_SPECIAL))
|
|
|
|
|
|
|
|
#define DECODE_SPECIAL_CACHE_PTR(ptr) \
|
|
|
|
((void*)(((uintptr_t)(ptr)) & ~CACHE_SPECIAL))
|
|
|
|
|
2015-07-06 15:22:40 +08:00
|
|
|
#define SKIP_EXT_OPLINE(opline) do { \
|
2015-07-06 15:24:51 +08:00
|
|
|
while (UNEXPECTED((opline)->opcode >= ZEND_EXT_STMT \
|
|
|
|
&& (opline)->opcode <= ZEND_TICKS)) { \
|
2015-07-06 15:22:40 +08:00
|
|
|
(opline)--; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2024-10-23 20:41:53 +08:00
|
|
|
#define ZEND_CLASS_HAS_TYPE_HINTS(ce) ((bool)(ce->ce_flags & ZEND_ACC_HAS_TYPE_HINTS))
|
|
|
|
#define ZEND_CLASS_HAS_READONLY_PROPS(ce) ((bool)(ce->ce_flags & ZEND_ACC_HAS_READONLY_PROPS))
|
2019-01-07 19:28:51 +08:00
|
|
|
|
2023-04-17 04:20:26 +08:00
|
|
|
|
|
|
|
ZEND_API bool zend_verify_class_constant_type(zend_class_constant *c, const zend_string *name, zval *constant);
|
|
|
|
ZEND_COLD void zend_verify_class_constant_type_error(const zend_class_constant *c, const zend_string *name, const zval *constant);
|
|
|
|
|
2023-01-03 23:38:56 +08:00
|
|
|
ZEND_API bool zend_verify_property_type(const zend_property_info *info, zval *property, bool strict);
|
|
|
|
ZEND_COLD void zend_verify_property_type_error(const zend_property_info *info, const zval *property);
|
|
|
|
ZEND_COLD void zend_magic_get_property_type_inconsistency_error(const zend_property_info *info, const zval *property);
|
2019-01-07 19:28:51 +08:00
|
|
|
|
|
|
|
#define ZEND_REF_ADD_TYPE_SOURCE(ref, source) \
|
|
|
|
zend_ref_add_type_source(&ZEND_REF_TYPE_SOURCES(ref), source)
|
|
|
|
|
|
|
|
#define ZEND_REF_DEL_TYPE_SOURCE(ref, source) \
|
|
|
|
zend_ref_del_type_source(&ZEND_REF_TYPE_SOURCES(ref), source)
|
|
|
|
|
|
|
|
#define ZEND_REF_FOREACH_TYPE_SOURCES(ref, prop) do { \
|
|
|
|
zend_property_info_source_list *_source_list = &ZEND_REF_TYPE_SOURCES(ref); \
|
|
|
|
zend_property_info **_prop, **_end; \
|
|
|
|
zend_property_info_list *_list; \
|
|
|
|
if (_source_list->ptr) { \
|
|
|
|
if (ZEND_PROPERTY_INFO_SOURCE_IS_LIST(_source_list->list)) { \
|
|
|
|
_list = ZEND_PROPERTY_INFO_SOURCE_TO_LIST(_source_list->list); \
|
|
|
|
_prop = _list->ptr; \
|
|
|
|
_end = _list->ptr + _list->num; \
|
|
|
|
} else { \
|
|
|
|
_prop = &_source_list->ptr; \
|
|
|
|
_end = _prop + 1; \
|
|
|
|
} \
|
|
|
|
for (; _prop < _end; _prop++) { \
|
|
|
|
prop = *_prop; \
|
|
|
|
|
|
|
|
#define ZEND_REF_FOREACH_TYPE_SOURCES_END() \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2023-01-03 23:38:56 +08:00
|
|
|
ZEND_COLD void zend_match_unhandled_error(const zval *value);
|
2021-07-30 06:19:47 +08:00
|
|
|
|
2024-09-05 06:35:55 +08:00
|
|
|
/* Call this to handle the timeout or the interrupt function. It will set
|
|
|
|
* EG(vm_interrupt) to false.
|
|
|
|
*/
|
|
|
|
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_fcall_interrupt(zend_execute_data *call);
|
|
|
|
|
2023-08-03 21:28:19 +08:00
|
|
|
static zend_always_inline void *zend_get_bad_ptr(void)
|
|
|
|
{
|
|
|
|
ZEND_UNREACHABLE();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2002-05-20 15:17:30 +08:00
|
|
|
END_EXTERN_C()
|
|
|
|
|
2000-07-03 08:55:36 +08:00
|
|
|
#endif /* ZEND_EXECUTE_H */
|