xref: /PHP-8.0/Zend/zend_execute.h (revision 5d1f3e04)
1 /*
2    +----------------------------------------------------------------------+
3    | Zend Engine                                                          |
4    +----------------------------------------------------------------------+
5    | Copyright (c) Zend Technologies Ltd. (http://www.zend.com)           |
6    +----------------------------------------------------------------------+
7    | This source file is subject to version 2.00 of the Zend license,     |
8    | that is bundled with this package in the file LICENSE, and is        |
9    | available through the world-wide-web at the following url:           |
10    | http://www.zend.com/license/2_00.txt.                                |
11    | If you did not receive a copy of the Zend license and are unable to  |
12    | obtain it through the world-wide-web, please send a note to          |
13    | license@zend.com so we can mail you a copy immediately.              |
14    +----------------------------------------------------------------------+
15    | Authors: Andi Gutmans <andi@php.net>                                 |
16    |          Zeev Suraski <zeev@php.net>                                 |
17    |          Dmitry Stogov <dmitry@php.net>                              |
18    +----------------------------------------------------------------------+
19 */
20 
21 #ifndef ZEND_EXECUTE_H
22 #define ZEND_EXECUTE_H
23 
24 #include "zend_compile.h"
25 #include "zend_hash.h"
26 #include "zend_operators.h"
27 #include "zend_variables.h"
28 
29 BEGIN_EXTERN_C()
30 struct _zend_fcall_info;
31 ZEND_API extern void (*zend_execute_ex)(zend_execute_data *execute_data);
32 ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data, zval *return_value);
33 
34 /* The lc_name may be stack allocated! */
35 ZEND_API extern zend_class_entry *(*zend_autoload)(zend_string *name, zend_string *lc_name);
36 
37 void init_executor(void);
38 void shutdown_executor(void);
39 void shutdown_destructors(void);
40 ZEND_API void zend_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value);
41 ZEND_API void zend_init_func_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value);
42 ZEND_API void zend_init_code_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value);
43 ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value);
44 ZEND_API void execute_ex(zend_execute_data *execute_data);
45 ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_value);
46 ZEND_API zend_bool zend_is_valid_class_name(zend_string *name);
47 ZEND_API zend_class_entry *zend_lookup_class(zend_string *name);
48 ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *lcname, uint32_t flags);
49 ZEND_API zend_class_entry *zend_get_called_scope(zend_execute_data *ex);
50 ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex);
51 ZEND_API zend_result zend_eval_string(const char *str, zval *retval_ptr, const char *string_name);
52 ZEND_API zend_result zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name);
53 ZEND_API zend_result zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, bool handle_exceptions);
54 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);
55 
56 /* export zend_pass_function to allow comparisons against it */
57 extern ZEND_API const zend_internal_function zend_pass_function;
58 
59 ZEND_API ZEND_COLD void ZEND_FASTCALL zend_missing_arg_error(zend_execute_data *execute_data);
60 ZEND_API ZEND_COLD void ZEND_FASTCALL zend_deprecated_function(const zend_function *fbc);
61 ZEND_COLD void ZEND_FASTCALL zend_param_must_be_ref(const zend_function *func, uint32_t arg_num);
62 
63 ZEND_API zend_bool ZEND_FASTCALL zend_verify_ref_assignable_zval(zend_reference *ref, zval *zv, zend_bool strict);
64 ZEND_API zend_bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref(zend_property_info *prop_info, zval *orig_val, zend_bool strict);
65 
66 ZEND_API ZEND_COLD void zend_throw_ref_type_error_zval(zend_property_info *prop, zval *zv);
67 ZEND_API ZEND_COLD void zend_throw_ref_type_error_type(zend_property_info *prop1, zend_property_info *prop2, zval *zv);
68 ZEND_API ZEND_COLD zend_result ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, zend_long lval);
69 ZEND_API ZEND_COLD zend_result ZEND_FASTCALL zend_undefined_index_write(HashTable *ht, zend_string *offset);
70 
71 ZEND_API zend_bool zend_verify_scalar_type_hint(uint32_t type_mask, zval *arg, zend_bool strict, zend_bool is_internal_arg);
72 ZEND_API ZEND_COLD void zend_verify_arg_error(
73 		const zend_function *zf, const zend_arg_info *arg_info, int arg_num, zval *value);
74 ZEND_API ZEND_COLD void zend_verify_return_error(
75 		const zend_function *zf, zval *value);
76 ZEND_API zend_bool zend_verify_ref_array_assignable(zend_reference *ref);
77 ZEND_API zend_bool zend_value_instanceof_static(zval *zv);
78 
79 
80 #define ZEND_REF_TYPE_SOURCES(ref) \
81 	(ref)->sources
82 
83 #define ZEND_REF_HAS_TYPE_SOURCES(ref) \
84 	(ZEND_REF_TYPE_SOURCES(ref).ptr != NULL)
85 
86 #define ZEND_REF_FIRST_SOURCE(ref) \
87 	(ZEND_PROPERTY_INFO_SOURCE_IS_LIST((ref)->sources.list) \
88 		? ZEND_PROPERTY_INFO_SOURCE_TO_LIST((ref)->sources.list)->ptr[0] \
89 		: (ref)->sources.ptr)
90 
91 
92 ZEND_API void ZEND_FASTCALL zend_ref_add_type_source(zend_property_info_source_list *source_list, zend_property_info *prop);
93 ZEND_API void ZEND_FASTCALL zend_ref_del_type_source(zend_property_info_source_list *source_list, zend_property_info *prop);
94 
95 ZEND_API zval* zend_assign_to_typed_ref(zval *variable_ptr, zval *value, zend_uchar value_type, zend_bool strict);
96 
zend_copy_to_variable(zval * variable_ptr,zval * value,zend_uchar value_type)97 static zend_always_inline void zend_copy_to_variable(zval *variable_ptr, zval *value, zend_uchar value_type)
98 {
99 	zend_refcounted *ref = NULL;
100 
101 	if (ZEND_CONST_COND(value_type & (IS_VAR|IS_CV), 1) && Z_ISREF_P(value)) {
102 		ref = Z_COUNTED_P(value);
103 		value = Z_REFVAL_P(value);
104 	}
105 
106 	ZVAL_COPY_VALUE(variable_ptr, value);
107 	if (ZEND_CONST_COND(value_type  == IS_CONST, 0)) {
108 		if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
109 			Z_ADDREF_P(variable_ptr);
110 		}
111 	} else if (value_type & (IS_CONST|IS_CV)) {
112 		if (Z_OPT_REFCOUNTED_P(variable_ptr)) {
113 			Z_ADDREF_P(variable_ptr);
114 		}
115 	} else if (ZEND_CONST_COND(value_type == IS_VAR, 1) && UNEXPECTED(ref)) {
116 		if (UNEXPECTED(GC_DELREF(ref) == 0)) {
117 			efree_size(ref, sizeof(zend_reference));
118 		} else if (Z_OPT_REFCOUNTED_P(variable_ptr)) {
119 			Z_ADDREF_P(variable_ptr);
120 		}
121 	}
122 }
123 
zend_assign_to_variable(zval * variable_ptr,zval * value,zend_uchar value_type,zend_bool strict)124 static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value, zend_uchar value_type, zend_bool strict)
125 {
126 	do {
127 		if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr))) {
128 			zend_refcounted *garbage;
129 
130 			if (Z_ISREF_P(variable_ptr)) {
131 				if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(variable_ptr)))) {
132 					return zend_assign_to_typed_ref(variable_ptr, value, value_type, strict);
133 				}
134 
135 				variable_ptr = Z_REFVAL_P(variable_ptr);
136 				if (EXPECTED(!Z_REFCOUNTED_P(variable_ptr))) {
137 					break;
138 				}
139 			}
140 			garbage = Z_COUNTED_P(variable_ptr);
141 			zend_copy_to_variable(variable_ptr, value, value_type);
142 			if (GC_DELREF(garbage) == 0) {
143 				rc_dtor_func(garbage);
144 			} else { /* we need to split */
145 				/* optimized version of GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr) */
146 				if (UNEXPECTED(GC_MAY_LEAK(garbage))) {
147 					gc_possible_root(garbage);
148 				}
149 			}
150 			return variable_ptr;
151 		}
152 	} while (0);
153 
154 	zend_copy_to_variable(variable_ptr, value, value_type);
155 	return variable_ptr;
156 }
157 
158 ZEND_API zend_result zval_update_constant(zval *pp);
159 ZEND_API zend_result zval_update_constant_ex(zval *pp, zend_class_entry *scope);
160 
161 /* dedicated Zend executor functions - do not use! */
162 struct _zend_vm_stack {
163 	zval *top;
164 	zval *end;
165 	zend_vm_stack prev;
166 };
167 
168 #define ZEND_VM_STACK_HEADER_SLOTS \
169 	((ZEND_MM_ALIGNED_SIZE(sizeof(struct _zend_vm_stack)) + ZEND_MM_ALIGNED_SIZE(sizeof(zval)) - 1) / ZEND_MM_ALIGNED_SIZE(sizeof(zval)))
170 
171 #define ZEND_VM_STACK_ELEMENTS(stack) \
172 	(((zval*)(stack)) + ZEND_VM_STACK_HEADER_SLOTS)
173 
174 /*
175  * In general in RELEASE build ZEND_ASSERT() must be zero-cost, but for some
176  * reason, GCC generated worse code, performing CSE on assertion code and the
177  * following "slow path" and moving memory read operatins from slow path into
178  * common header. This made a degradation for the fast path.
179  * The following "#if ZEND_DEBUG" eliminates it.
180  */
181 #if ZEND_DEBUG
182 # define ZEND_ASSERT_VM_STACK(stack) ZEND_ASSERT(stack->top > (zval *) stack && stack->end > (zval *) stack && stack->top <= stack->end)
183 # 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))
184 #else
185 # define ZEND_ASSERT_VM_STACK(stack)
186 # define ZEND_ASSERT_VM_STACK_GLOBAL
187 #endif
188 
189 ZEND_API void zend_vm_stack_init(void);
190 ZEND_API void zend_vm_stack_init_ex(size_t page_size);
191 ZEND_API void zend_vm_stack_destroy(void);
192 ZEND_API void* zend_vm_stack_extend(size_t size);
193 
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)194 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)
195 {
196 	call->func = func;
197 	Z_PTR(call->This) = object_or_called_scope;
198 	ZEND_CALL_INFO(call) = call_info;
199 	ZEND_CALL_NUM_ARGS(call) = num_args;
200 }
201 
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)202 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)
203 {
204 	zend_execute_data *call = (zend_execute_data*)EG(vm_stack_top);
205 
206 	ZEND_ASSERT_VM_STACK_GLOBAL;
207 
208 	if (UNEXPECTED(used_stack > (size_t)(((char*)EG(vm_stack_end)) - (char*)call))) {
209 		call = (zend_execute_data*)zend_vm_stack_extend(used_stack);
210 		ZEND_ASSERT_VM_STACK_GLOBAL;
211 		zend_vm_init_call_frame(call, call_info | ZEND_CALL_ALLOCATED, func, num_args, object_or_called_scope);
212 		return call;
213 	} else {
214 		EG(vm_stack_top) = (zval*)((char*)call + used_stack);
215 		zend_vm_init_call_frame(call, call_info, func, num_args, object_or_called_scope);
216 		return call;
217 	}
218 }
219 
zend_vm_calc_used_stack(uint32_t num_args,zend_function * func)220 static zend_always_inline uint32_t zend_vm_calc_used_stack(uint32_t num_args, zend_function *func)
221 {
222 	uint32_t used_stack = ZEND_CALL_FRAME_SLOT + num_args;
223 
224 	if (EXPECTED(ZEND_USER_CODE(func->type))) {
225 		used_stack += func->op_array.last_var + func->op_array.T - MIN(func->op_array.num_args, num_args);
226 	}
227 	return used_stack * sizeof(zval);
228 }
229 
zend_vm_stack_push_call_frame(uint32_t call_info,zend_function * func,uint32_t num_args,void * object_or_called_scope)230 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)
231 {
232 	uint32_t used_stack = zend_vm_calc_used_stack(num_args, func);
233 
234 	return zend_vm_stack_push_call_frame_ex(used_stack, call_info,
235 		func, num_args, object_or_called_scope);
236 }
237 
zend_vm_stack_free_extra_args_ex(uint32_t call_info,zend_execute_data * call)238 static zend_always_inline void zend_vm_stack_free_extra_args_ex(uint32_t call_info, zend_execute_data *call)
239 {
240 	if (UNEXPECTED(call_info & ZEND_CALL_FREE_EXTRA_ARGS)) {
241 		uint32_t count = ZEND_CALL_NUM_ARGS(call) - call->func->op_array.num_args;
242 		zval *p = ZEND_CALL_VAR_NUM(call, call->func->op_array.last_var + call->func->op_array.T);
243 		do {
244 			i_zval_ptr_dtor(p);
245 			p++;
246 		} while (--count);
247  	}
248 }
249 
zend_vm_stack_free_extra_args(zend_execute_data * call)250 static zend_always_inline void zend_vm_stack_free_extra_args(zend_execute_data *call)
251 {
252 	zend_vm_stack_free_extra_args_ex(ZEND_CALL_INFO(call), call);
253 }
254 
zend_vm_stack_free_args(zend_execute_data * call)255 static zend_always_inline void zend_vm_stack_free_args(zend_execute_data *call)
256 {
257 	uint32_t num_args = ZEND_CALL_NUM_ARGS(call);
258 
259 	if (EXPECTED(num_args > 0)) {
260 		zval *p = ZEND_CALL_ARG(call, 1);
261 
262 		do {
263 			zval_ptr_dtor_nogc(p);
264 			p++;
265 		} while (--num_args);
266 	}
267 }
268 
zend_vm_stack_free_call_frame_ex(uint32_t call_info,zend_execute_data * call)269 static zend_always_inline void zend_vm_stack_free_call_frame_ex(uint32_t call_info, zend_execute_data *call)
270 {
271 	ZEND_ASSERT_VM_STACK_GLOBAL;
272 
273 	if (UNEXPECTED(call_info & ZEND_CALL_ALLOCATED)) {
274 		zend_vm_stack p = EG(vm_stack);
275 		zend_vm_stack prev = p->prev;
276 
277 		ZEND_ASSERT(call == (zend_execute_data*)ZEND_VM_STACK_ELEMENTS(EG(vm_stack)));
278 		EG(vm_stack_top) = prev->top;
279 		EG(vm_stack_end) = prev->end;
280 		EG(vm_stack) = prev;
281 		efree(p);
282 	} else {
283 		EG(vm_stack_top) = (zval*)call;
284 	}
285 
286 	ZEND_ASSERT_VM_STACK_GLOBAL;
287 }
288 
zend_vm_stack_free_call_frame(zend_execute_data * call)289 static zend_always_inline void zend_vm_stack_free_call_frame(zend_execute_data *call)
290 {
291 	zend_vm_stack_free_call_frame_ex(ZEND_CALL_INFO(call), call);
292 }
293 
294 zend_execute_data *zend_vm_stack_copy_call_frame(
295 	zend_execute_data *call, uint32_t passed_args, uint32_t additional_args);
296 
zend_vm_stack_extend_call_frame(zend_execute_data ** call,uint32_t passed_args,uint32_t additional_args)297 static zend_always_inline void zend_vm_stack_extend_call_frame(
298 	zend_execute_data **call, uint32_t passed_args, uint32_t additional_args)
299 {
300 	if (EXPECTED((uint32_t)(EG(vm_stack_end) - EG(vm_stack_top)) > additional_args)) {
301 		EG(vm_stack_top) += additional_args;
302 	} else {
303 		*call = zend_vm_stack_copy_call_frame(*call, passed_args, additional_args);
304 	}
305 }
306 
307 ZEND_API void ZEND_FASTCALL zend_free_extra_named_params(zend_array *extra_named_params);
308 
309 /* services */
310 ZEND_API const char *get_active_class_name(const char **space);
311 ZEND_API const char *get_active_function_name(void);
312 ZEND_API const char *get_active_function_arg_name(uint32_t arg_num);
313 ZEND_API const char *get_function_arg_name(const zend_function *func, uint32_t arg_num);
314 ZEND_API zend_string *get_active_function_or_method_name(void);
315 ZEND_API zend_string *get_function_or_method_name(const zend_function *func);
316 ZEND_API const char *zend_get_executed_filename(void);
317 ZEND_API zend_string *zend_get_executed_filename_ex(void);
318 ZEND_API uint32_t zend_get_executed_lineno(void);
319 ZEND_API zend_class_entry *zend_get_executed_scope(void);
320 ZEND_API zend_bool zend_is_executing(void);
321 ZEND_API ZEND_COLD void ZEND_FASTCALL zend_cannot_pass_by_reference(uint32_t arg_num);
322 
323 ZEND_API void zend_set_timeout(zend_long seconds, bool reset_signals);
324 ZEND_API void zend_unset_timeout(void);
325 ZEND_API ZEND_NORETURN void ZEND_FASTCALL zend_timeout(void);
326 ZEND_API zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_type);
327 ZEND_API zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, zend_string *lcname, int fetch_type);
328 
329 ZEND_API zend_function * ZEND_FASTCALL zend_fetch_function(zend_string *name);
330 ZEND_API zend_function * ZEND_FASTCALL zend_fetch_function_str(const char *name, size_t len);
331 ZEND_API void ZEND_FASTCALL zend_init_func_run_time_cache(zend_op_array *op_array);
332 
333 ZEND_API void zend_fetch_dimension_const(zval *result, zval *container, zval *dim, int type);
334 
335 ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute_data_ptr, uint32_t var);
336 
337 #define ZEND_USER_OPCODE_CONTINUE   0 /* execute next opcode */
338 #define ZEND_USER_OPCODE_RETURN     1 /* exit from executor (return from function) */
339 #define ZEND_USER_OPCODE_DISPATCH   2 /* call original opcode handler */
340 #define ZEND_USER_OPCODE_ENTER      3 /* enter into new op_array without recursion */
341 #define ZEND_USER_OPCODE_LEAVE      4 /* return to calling op_array within the same executor */
342 
343 #define ZEND_USER_OPCODE_DISPATCH_TO 0x100 /* call original handler of returned opcode */
344 
345 ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler);
346 ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode);
347 
348 ZEND_API zval *zend_get_zval_ptr(const zend_op *opline, int op_type, const znode_op *node, const zend_execute_data *execute_data);
349 
350 ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table);
351 ZEND_API void zend_free_compiled_variables(zend_execute_data *execute_data);
352 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);
353 ZEND_API void zend_cleanup_unfinished_execution(zend_execute_data *execute_data, uint32_t op_num, uint32_t catch_op_num);
354 
355 zval * ZEND_FASTCALL zend_handle_named_arg(
356 		zend_execute_data **call_ptr, zend_string *arg_name,
357 		uint32_t *arg_num_ptr, void **cache_slot);
358 ZEND_API int ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *call);
359 
360 #define CACHE_ADDR(num) \
361 	((void**)((char*)EX(run_time_cache) + (num)))
362 
363 #define CACHED_PTR(num) \
364 	((void**)((char*)EX(run_time_cache) + (num)))[0]
365 
366 #define CACHE_PTR(num, ptr) do { \
367 		((void**)((char*)EX(run_time_cache) + (num)))[0] = (ptr); \
368 	} while (0)
369 
370 #define CACHED_POLYMORPHIC_PTR(num, ce) \
371 	(EXPECTED(((void**)((char*)EX(run_time_cache) + (num)))[0] == (void*)(ce)) ? \
372 		((void**)((char*)EX(run_time_cache) + (num)))[1] : \
373 		NULL)
374 
375 #define CACHE_POLYMORPHIC_PTR(num, ce, ptr) do { \
376 		void **slot = (void**)((char*)EX(run_time_cache) + (num)); \
377 		slot[0] = (ce); \
378 		slot[1] = (ptr); \
379 	} while (0)
380 
381 #define CACHED_PTR_EX(slot) \
382 	(slot)[0]
383 
384 #define CACHE_PTR_EX(slot, ptr) do { \
385 		(slot)[0] = (ptr); \
386 	} while (0)
387 
388 #define CACHED_POLYMORPHIC_PTR_EX(slot, ce) \
389 	(EXPECTED((slot)[0] == (ce)) ? (slot)[1] : NULL)
390 
391 #define CACHE_POLYMORPHIC_PTR_EX(slot, ce, ptr) do { \
392 		(slot)[0] = (ce); \
393 		(slot)[1] = (ptr); \
394 	} while (0)
395 
396 #define CACHE_SPECIAL (1<<0)
397 
398 #define IS_SPECIAL_CACHE_VAL(ptr) \
399 	(((uintptr_t)(ptr)) & CACHE_SPECIAL)
400 
401 #define ENCODE_SPECIAL_CACHE_NUM(num) \
402 	((void*)((((uintptr_t)(num)) << 1) | CACHE_SPECIAL))
403 
404 #define DECODE_SPECIAL_CACHE_NUM(ptr) \
405 	(((uintptr_t)(ptr)) >> 1)
406 
407 #define ENCODE_SPECIAL_CACHE_PTR(ptr) \
408 	((void*)(((uintptr_t)(ptr)) | CACHE_SPECIAL))
409 
410 #define DECODE_SPECIAL_CACHE_PTR(ptr) \
411 	((void*)(((uintptr_t)(ptr)) & ~CACHE_SPECIAL))
412 
413 #define SKIP_EXT_OPLINE(opline) do { \
414 		while (UNEXPECTED((opline)->opcode >= ZEND_EXT_STMT \
415 			&& (opline)->opcode <= ZEND_TICKS)) {     \
416 			(opline)--;                                  \
417 		}                                                \
418 	} while (0)
419 
420 #define ZEND_CLASS_HAS_TYPE_HINTS(ce) ((ce->ce_flags & ZEND_ACC_HAS_TYPE_HINTS) == ZEND_ACC_HAS_TYPE_HINTS)
421 
422 ZEND_API zend_bool zend_verify_property_type(zend_property_info *info, zval *property, zend_bool strict);
423 ZEND_COLD void zend_verify_property_type_error(zend_property_info *info, zval *property);
424 
425 #define ZEND_REF_ADD_TYPE_SOURCE(ref, source) \
426 	zend_ref_add_type_source(&ZEND_REF_TYPE_SOURCES(ref), source)
427 
428 #define ZEND_REF_DEL_TYPE_SOURCE(ref, source) \
429 	zend_ref_del_type_source(&ZEND_REF_TYPE_SOURCES(ref), source)
430 
431 #define ZEND_REF_FOREACH_TYPE_SOURCES(ref, prop) do { \
432 		zend_property_info_source_list *_source_list = &ZEND_REF_TYPE_SOURCES(ref); \
433 		zend_property_info **_prop, **_end; \
434 		zend_property_info_list *_list; \
435 		if (_source_list->ptr) { \
436 			if (ZEND_PROPERTY_INFO_SOURCE_IS_LIST(_source_list->list)) { \
437 				_list = ZEND_PROPERTY_INFO_SOURCE_TO_LIST(_source_list->list); \
438 				_prop = _list->ptr; \
439 				_end = _list->ptr + _list->num; \
440 			} else { \
441 				_prop = &_source_list->ptr; \
442 				_end = _prop + 1; \
443 			} \
444 			for (; _prop < _end; _prop++) { \
445 				prop = *_prop; \
446 
447 #define ZEND_REF_FOREACH_TYPE_SOURCES_END() \
448 			} \
449 		} \
450 	} while (0)
451 
452 
453 END_EXTERN_C()
454 
455 #endif /* ZEND_EXECUTE_H */
456