21#include <zend_language_parser.h>
42#define SET_NODE(target, src) do { \
43 target ## _type = (src)->op_type; \
44 if ((src)->op_type == IS_CONST) { \
45 target.constant = zend_add_literal(&(src)->u.constant); \
47 target = (src)->u.op; \
51#define GET_NODE(target, src) do { \
52 (target)->op_type = src ## _type; \
53 if ((target)->op_type == IS_CONST) { \
54 ZVAL_COPY_VALUE(&(target)->u.constant, CT_CONSTANT(src)); \
56 (target)->u.op = src; \
60#define FC(member) (CG(file_context).member)
69static inline uint32_t zend_alloc_cache_slots(
unsigned count) {
83static inline uint32_t zend_alloc_cache_slot(
void) {
84 return zend_alloc_cache_slots(1);
97static void zend_eval_const_expr(
zend_ast **ast_ptr);
102static void zend_compile_stmt(
zend_ast *ast);
105#ifdef ZEND_CHECK_STACK_LIMIT
108 size_t max_stack_size = 0;
109 if ((uintptr_t)
EG(stack_base) > (uintptr_t)
EG(stack_limit)) {
110 max_stack_size = (size_t) ((uintptr_t)
EG(stack_base) - (uintptr_t)
EG(stack_limit));
114 "Maximum call stack size of %zu bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached during compilation. Try splitting expression",
118static void zend_check_stack_limit(
void)
120 if (
UNEXPECTED(zend_call_stack_overflowed(
EG(stack_limit)))) {
121 zend_stack_limit_error();
125static void zend_check_stack_limit(
void)
130static void init_op(
zend_op *op)
135#ifdef ZEND_VERIFY_TYPE_INFERENCE
136 op->op1_use_type = 0;
137 op->op2_use_type = 0;
138 op->result_use_type = 0;
139 op->op1_def_type = 0;
140 op->op2_def_type = 0;
141 op->result_def_type = 0;
147 return CG(active_op_array)->last;
150static zend_op *get_next_op(
void)
153 uint32_t next_op_num = op_array->
last++;
161 next_op = &(op_array->
opcodes[next_op_num]);
184static bool zend_get_unqualified_name(
const zend_string *
name,
const char **
result,
size_t *result_len)
187 if (ns_separator !=
NULL) {
188 *
result = ns_separator + 1;
226 zend_get_unqualified_name(
name, &uqname, &uqname_len);
228 for (; reserved->
name; ++reserved) {
229 if (uqname_len == reserved->
len
242 if (zend_is_reserved_class_name(
name)) {
292 for (; info->
name; ++info) {
310 for (; info->
name; ++info) {
340 CG(
context).in_jmp_frameless_branch =
false;
361static void zend_reset_import_tables(
void)
369 if (
FC(imports_function)) {
372 FC(imports_function) =
NULL;
375 if (
FC(imports_const)) {
385static void zend_end_namespace(
void) {
386 FC(in_namespace) = 0;
387 zend_reset_import_tables();
388 if (
FC(current_namespace)) {
390 FC(current_namespace) =
NULL;
397 *prev_context =
CG(file_context);
399 FC(imports_function) =
NULL;
401 FC(current_namespace) =
NULL;
402 FC(in_namespace) = 0;
403 FC(has_bracketed_namespaces) = 0;
404 FC(declarables).ticks = 0;
411 zend_end_namespace();
413 CG(file_context) = *prev_context;
422 CG(active_class_entry) =
NULL;
423 CG(in_compilation) = 0;
424 CG(skip_shebang) = 0;
426 CG(encoding_declared) = 0;
427 CG(memoized_exprs) =
NULL;
450 CG(
arena) = zend_arena_create(64 * 1024);
451 CG(active_op_array) =
NULL;
456 CG(unclean_shutdown) = 0;
458 CG(delayed_variance_obligations) =
NULL;
459 CG(delayed_autoloads) =
NULL;
461 CG(current_linking_class) =
NULL;
474 if (
CG(delayed_variance_obligations)) {
477 CG(delayed_variance_obligations) =
NULL;
479 if (
CG(delayed_autoloads)) {
482 CG(delayed_autoloads) =
NULL;
484 if (
CG(unlinked_uses)) {
489 CG(current_linking_class) =
NULL;
495 CG(compiled_filename) = zend_string_copy(new_compiled_filename);
496 return new_compiled_filename;
502 if (
CG(compiled_filename)) {
503 zend_string_release(
CG(compiled_filename));
504 CG(compiled_filename) =
NULL;
506 CG(compiled_filename) = original_compiled_filename;
512 return CG(compiled_filename);
518 return CG(zend_lineno);
524 return CG(in_compilation);
530 return (uint32_t)
CG(active_op_array)->T++;
539 while (i < op_array->last_var) {
541 && zend_string_equals(op_array->
vars[i],
name)) {
553 op_array->
vars[i] = zend_string_copy(
name);
569static inline void zend_insert_literal(
zend_op_array *op_array,
zval *
zv,
int literal_position)
583static int zend_add_literal(
zval *
zv)
594 zend_insert_literal(op_array,
zv, i);
599static inline int zend_add_literal_string(
zend_string **str)
604 ret = zend_add_literal(&
zv);
613 int ret = zend_add_literal_string(&
name);
617 zend_add_literal_string(&lc_name);
625 const char *unqualified_name;
626 size_t unqualified_name_len;
629 int ret = zend_add_literal_string(&
name);
633 zend_add_literal_string(&lc_name);
636 if (zend_get_unqualified_name(
name, &unqualified_name, &unqualified_name_len)) {
637 lc_name = zend_string_alloc(unqualified_name_len, 0);
639 zend_add_literal_string(&lc_name);
649 int ret = zend_add_literal_string(&
name);
653 zend_add_literal_string(&lc_name);
659static int zend_add_const_name_literal(
zend_string *
name,
bool unqualified)
663 int ret = zend_add_literal_string(&
name);
685 tmp_name = zend_string_init(after_ns, after_ns_len, 0);
692#define LITERAL_STR(op, str) do { \
694 ZVAL_STR(&_c, str); \
695 op.constant = zend_add_literal(&_c); \
707static inline void zend_begin_loop(
708 uint8_t free_opcode,
const znode *loop_var,
bool is_switch)
711 int parent =
CG(
context).current_brk_cont;
715 brk_cont_element = get_next_brk_cont_element();
716 brk_cont_element->
parent = parent;
720 uint32_t
start = get_next_op_number();
722 info.
opcode = free_opcode;
730 brk_cont_element->
start = -1;
737static inline void zend_end_loop(
int cont_addr,
const znode *var_node)
739 uint32_t
end = get_next_op_number();
742 brk_cont_element->
cont = cont_addr;
743 brk_cont_element->
brk =
end;
753 zend_op *opline = &
CG(active_op_array)->opcodes[
CG(active_op_array)->last-1];
797 zend_op *opline = &
CG(active_op_array)->opcodes[
CG(active_op_array)->last-1];
818 while (opline >=
CG(active_op_array)->opcodes) {
840 zval_ptr_dtor_nogc(&
op1->u.constant);
846static char *zend_modifier_token_to_string(uint32_t token)
864 return "public(set)";
866 return "protected(set)";
868 return "private(set)";
937 member =
"class constant";
939 member =
"parameter";
941 member =
"property hook";
947 "Cannot use the %s modifier on a %s", zend_modifier_token_to_string(token), member);
956 for (uint32_t i = 0; i < modifier_list->
children; i++) {
972 uint32_t new_flags =
flags | new_flag;
975 "Multiple abstract modifiers are not allowed", 0);
988 "Cannot use the final modifier on an abstract class", 0);
997 uint32_t new_flags =
flags | new_flag;
1000 "Cannot use the abstract modifier on an anonymous class", 0);
1016 uint32_t new_flags =
flags | new_flag;
1019 "Multiple access type modifiers are not allowed", 0);
1036 "Multiple readonly modifiers are not allowed", 0);
1042 "Cannot use the final modifier on an abstract method", 0);
1047 "Cannot use the final modifier on an abstract property", 0);
1054 "Multiple access type modifiers are not allowed", 0);
1065 "::",
sizeof(
"::") - 1,
1069static zend_string *zend_concat_names(
char *name1,
size_t name1_len,
char *name2,
size_t name2_len) {
1074 if (
FC(current_namespace)) {
1078 return zend_string_copy(
name);
1084 bool case_sensitive,
HashTable *current_import_sub
1087 *is_fully_qualified = 0;
1091 *is_fully_qualified = 1;
1096 *is_fully_qualified = 1;
1097 return zend_string_copy(
name);
1101 *is_fully_qualified = 1;
1102 return zend_prefix_with_ns(
name);
1105 if (current_import_sub) {
1108 if (case_sensitive) {
1109 import_name = zend_hash_find_ptr(current_import_sub,
name);
1115 *is_fully_qualified = 1;
1116 return zend_string_copy(import_name);
1122 *is_fully_qualified = 1;
1125 if (compound &&
FC(imports)) {
1131 return zend_concat_names(
1136 return zend_prefix_with_ns(
name);
1142 return zend_resolve_non_class_name(
1143 name,
type, is_fully_qualified, 0,
FC(imports_function));
1148 return zend_resolve_non_class_name(
1149 name,
type, is_fully_qualified, 1,
FC(imports_const));
1163 "'namespace\\%s' is an invalid class name",
ZSTR_VAL(
name));
1166 return zend_string_copy(
name);
1170 return zend_prefix_with_ns(
name);
1184 return zend_string_copy(
name);
1196 return zend_concat_names(
1205 return zend_string_copy(import_name);
1211 return zend_prefix_with_ns(
name);
1217 zval *class_name = zend_ast_get_zval(ast);
1221 return zend_resolve_class_name(
Z_STR_P(class_name), ast->
attr);
1225static void label_ptr_dtor(
zval *
zv)
1231static void str_dtor(
zval *
zv) {
1236static bool zend_is_call(
zend_ast *ast);
1238static uint32_t zend_add_try_element(uint32_t try_op)
1253 return try_catch_offset;
1269 if (
function->common.function_name) {
1270 zend_string_addref(
function->common.function_name);
1303 if (
func->op_array.refcount) {
1304 ++*
func->op_array.refcount;
1306 if (
func->common.function_name) {
1307 zend_string_addref(
func->common.function_name);
1346 if (!is_preloaded) {
1383 if (is_intersection) {
1386 zend_string_release(
type);
1390 zend_string_release(
type);
1411 return zend_string_copy(
name);
1426 intersection_str = add_type_string(intersection_str, resolved,
true);
1427 zend_string_release(resolved);
1434 zend_string_release(intersection_str);
1435 intersection_str =
result;
1437 str = add_type_string(str, intersection_str,
false);
1438 zend_string_release(intersection_str);
1461 str = add_type_string(str, resolved,
false);
1462 zend_string_release(resolved);
1471 str = add_type_string(str,
ZSTR_KNOWN(ZEND_STR_MIXED),
false);
1484 str = add_type_string(str,
name,
false);
1487 str = add_type_string(str,
ZSTR_KNOWN(ZEND_STR_CALLABLE),
false);
1490 str = add_type_string(str,
ZSTR_KNOWN(ZEND_STR_OBJECT),
false);
1493 str = add_type_string(str,
ZSTR_KNOWN(ZEND_STR_ARRAY),
false);
1496 str = add_type_string(str,
ZSTR_KNOWN(ZEND_STR_STRING),
false);
1499 str = add_type_string(str,
ZSTR_KNOWN(ZEND_STR_INT),
false);
1502 str = add_type_string(str,
ZSTR_KNOWN(ZEND_STR_FLOAT),
false);
1505 str = add_type_string(str,
ZSTR_KNOWN(ZEND_STR_BOOL),
false);
1507 str = add_type_string(str,
ZSTR_KNOWN(ZEND_STR_FALSE),
false);
1509 str = add_type_string(str,
ZSTR_KNOWN(ZEND_STR_TRUE),
false);
1512 str = add_type_string(str,
ZSTR_KNOWN(ZEND_STR_VOID),
false);
1515 str = add_type_string(str,
ZSTR_KNOWN(ZEND_STR_NEVER),
false);
1521 if (!is_union && !has_intersection) {
1523 zend_string_release(str);
1524 return nullable_str;
1527 str = add_type_string(str,
ZSTR_KNOWN(ZEND_STR_NULL_LOWERCASE),
false);
1542static void zend_mark_function_as_generator(
void)
1544 if (!
CG(active_op_array)->function_name) {
1546 "The \"yield\" expression can only be used inside a function");
1550 zend_type return_type =
CG(active_op_array)->arg_info[-1].type;
1556 && is_generator_compatible_class_type(
ZEND_TYPE_NAME(*single_type))) {
1566 "Generator return type must be a supertype of Generator, %s given",
1577 size_t prop_name_length = 1 + src1_length + 1 + src2_length;
1578 zend_string *prop_name = zend_string_alloc(prop_name_length, internal);
1582 memcpy(
ZSTR_VAL(prop_name) + 1 + src1_length + 1, src2, src2_length+1);
1589 size_t class_name_len;
1590 size_t anonclass_src_len;
1621 anonclass_src_len = zend_strnlen(*class_name + class_name_len + 1,
ZSTR_LEN(
name) - class_name_len - 2);
1622 if (class_name_len + anonclass_src_len + 2 !=
ZSTR_LEN(
name)) {
1623 class_name_len += anonclass_src_len + 1;
1633static bool array_is_const_ex(
zend_array *array, uint32_t *max_checks)
1635 if (zend_hash_num_elements(array) > *max_checks) {
1638 *max_checks -= zend_hash_num_elements(array);
1645 if (!array_is_const_ex(array, max_checks)) {
1658 uint32_t max_checks = 50;
1659 return array_is_const_ex(array, &max_checks);
1690 if (!is_fully_qualified) {
1691 zend_get_unqualified_name(
name, &lookup_name, &lookup_len);
1695 if ((c = zend_get_special_const(lookup_name, lookup_len))) {
1699 c = zend_hash_find_ptr(
EG(zend_constants),
name);
1700 if (c && can_ct_eval_const(c)) {
1708static inline bool zend_is_scope_known(
void)
1710 if (!
CG(active_op_array)) {
1720 if (!
CG(active_class_entry)) {
1723 return CG(active_op_array)->function_name !=
NULL;
1731static inline bool class_name_refers_to_active_ce(
zend_string *class_name, uint32_t fetch_type)
1733 if (!
CG(active_class_entry)) {
1758static uint32_t zend_get_class_fetch_type_ast(
zend_ast *name_ast)
1774 "Cannot use \"%s\" as %s, as it is reserved",
1777 return zend_resolve_class_name(class_name, ast->
attr);
1780static void zend_ensure_valid_class_fetch_type(uint32_t fetch_type)
1790 "Cannot use \"parent\" when current class scope has no parent");
1796static bool zend_try_compile_const_expr_resolve_class_name(
zval *
zv,
zend_ast *class_ast)
1798 uint32_t fetch_type;
1805 class_name = zend_ast_get_zval(class_ast);
1812 zend_ensure_valid_class_fetch_type(fetch_type);
1814 switch (fetch_type) {
1816 if (
CG(active_class_entry) && zend_is_scope_known()) {
1822 if (
CG(active_class_entry) &&
CG(active_class_entry)->parent_name
1823 && zend_is_scope_known()) {
1831 ZVAL_STR(
zv, zend_resolve_class_name_ast(class_ast));
1881 if (class_name_refers_to_active_ce(class_name, fetch_type)) {
1882 cc = zend_hash_find_ptr(&
CG(active_class_entry)->constants_table,
name);
1898 if (!cc || !zend_verify_ct_const_access(cc,
CG(active_class_entry))) {
1917static void zend_add_to_list(
void *
result,
void *item)
1919 void** list = *(
void**)
result;
1928 list =
erealloc(list,
sizeof(
void*) * (
n+2));
1937static void zend_do_extended_stmt(
void)
1945 opline = get_next_op();
1951static void zend_do_extended_fcall_begin(
void)
1959 opline = get_next_op();
1965static void zend_do_extended_fcall_end(
void)
1973 opline = get_next_op();
1982 if ((auto_global = zend_hash_str_find_ptr(
CG(auto_globals),
name,
len)) !=
NULL) {
1983 if (auto_global->
armed) {
1996 if ((auto_global = zend_hash_find_ptr(
CG(auto_globals),
name)) !=
NULL) {
1997 if (auto_global->
armed) {
2013 auto_global.
jit = jit;
2026 if (auto_global->
jit) {
2027 auto_global->
armed = 1;
2031 auto_global->
armed = 0;
2042 if (
CG(increment_lineno)) {
2044 CG(increment_lineno) = 0;
2084 if (nullify_handlers) {
2131 zval *left_zv = zend_ast_get_zval(left_ast);
2152 zval *
zv = zend_ast_get_zval(ast);
2172static void zend_verify_namespace(
void)
2174 if (
FC(has_bracketed_namespaces) && !
FC(in_namespace)) {
2184 char *
end = path +
len - 1;
2185 unsigned int len_adjust = 0;
2191 if ((2 <=
len) && isalpha((
int)((
unsigned char *)path)[0]) && (
':' == path[1])) {
2218 return 1 + len_adjust;
2229 return 1 + len_adjust;
2239 return 1 + len_adjust;
2243 return (
size_t)(
end + 1 - path) + len_adjust;
2257 opline->
opcode += 1 * factor;
2260 opline->
opcode += 2 * factor;
2265 opline->
opcode += 3 * factor;
2268 opline->
opcode += 4 * factor;
2271 opline->
opcode += 5 * factor;
2281 opline->
result.
var = get_temporary_variable();
2289 opline->
result.
var = get_temporary_variable();
2296 zend_op *opline = get_next_op();
2308 zend_make_var_result(
result, opline);
2316 zend_op *opline = get_next_op();
2328 zend_make_tmp_result(
result, opline);
2335static void zend_emit_tick(
void)
2340 if (
CG(active_op_array)->
last &&
CG(active_op_array)->opcodes[
CG(active_op_array)->
last - 1].opcode ==
ZEND_TICKS) {
2344 opline = get_next_op();
2357static inline uint32_t zend_emit_jump(uint32_t opnum_target)
2359 uint32_t opnum = get_next_op_number();
2368 switch (opline->
opcode) {
2394static inline uint32_t zend_emit_cond_jump(uint8_t opcode,
znode *cond, uint32_t opnum_target)
2396 uint32_t opnum = get_next_op_number();
2399 if (cond->op_type ==
IS_TMP_VAR && opnum > 0) {
2400 opline =
CG(active_op_array)->opcodes + opnum - 1;
2412 opline = zend_emit_op(
NULL, opcode, cond,
NULL);
2418static inline void zend_update_jump_target(uint32_t opnum_jump, uint32_t opnum_target)
2420 zend_op *opline = &
CG(active_op_array)->opcodes[opnum_jump];
2421 switch (opline->
opcode) {
2441static inline void zend_update_jump_target_to_next(uint32_t opnum_jump)
2443 zend_update_jump_target(opnum_jump, get_next_op_number());
2451 init_op(&tmp_opline);
2453 tmp_opline.
opcode = opcode;
2461 zend_make_var_result(
result, &tmp_opline);
2469static inline uint32_t zend_delayed_compile_begin(
void)
2483 opline = get_next_op();
2490 CG(delayed_oplines_stack).top =
offset;
2495static bool zend_ast_kind_is_short_circuited(
zend_ast_kind ast_kind)
2511static bool zend_ast_is_short_circuited(
const zend_ast *ast)
2513 switch (ast->
kind) {
2519 return zend_ast_is_short_circuited(ast->
child[0]);
2528static void zend_assert_not_short_circuited(
const zend_ast *ast)
2530 if (zend_ast_is_short_circuited(ast)) {
2539#define ZEND_SHORT_CIRCUITING_INNER 0x8000
2541static void zend_short_circuiting_mark_inner(
zend_ast *ast) {
2542 if (zend_ast_kind_is_short_circuited(ast->
kind)) {
2547static uint32_t zend_short_circuiting_checkpoint(
void)
2552static void zend_short_circuiting_commit(uint32_t checkpoint,
znode *
result,
zend_ast *ast)
2554 bool is_short_circuited = zend_ast_kind_is_short_circuited(ast->
kind)
2556 if (!is_short_circuited) {
2558 &&
"Short circuiting stack should be empty");
2568 uint32_t opnum = *(uint32_t *)
zend_stack_top(&
CG(short_circuiting_opnums));
2569 zend_op *opline = &
CG(active_op_array)->opcodes[opnum];
2580static void zend_emit_jmp_null(
znode *obj_node, uint32_t bp_type)
2582 uint32_t jmp_null_opnum = get_next_op_number();
2597 znode memoized_result;
2601 zend_compile_expr(
result, expr);
2612 memoized_result = *
result;
2615 zend_hash_index_update_mem(
2616 CG(memoized_exprs), (uintptr_t) expr, &memoized_result,
sizeof(
znode));
2618 znode *memoized_result = zend_hash_index_find_ptr(
CG(memoized_exprs), (uintptr_t) expr);
2619 *
result = *memoized_result;
2656static void zend_emit_return_type_check(
2668 "A void %s must not return a value "
2669 "(did you mean \"return;\" instead of \"return null;\"?)",
2670 CG(active_class_entry) !=
NULL ?
"method" :
"function");
2673 CG(active_class_entry) !=
NULL ?
"method" :
"function");
2685 CG(active_class_entry) !=
NULL ?
"method" :
"function");
2689 if (!expr && !implicit) {
2692 "A %s with return type must return a value "
2693 "(did you mean \"return null;\" instead of \"return;\"?)",
2694 CG(active_class_entry) !=
NULL ?
"method" :
"function");
2697 "A %s with return type must return a value",
2698 CG(active_class_entry) !=
NULL ?
"method" :
"function");
2713 if (expr && expr->op_type ==
IS_CONST) {
2715 opline->
result.
var = expr->u.op.var = get_temporary_variable();
2718 opline->
op2.
num = zend_alloc_cache_slots(zend_type_get_num_classes(return_info->
type));
2738 zend_emit_return_type_check(
NULL, return_info, 1);
2749 ret->extended_value = -1;
2753static inline bool zend_is_variable(
zend_ast *ast)
2763static inline bool zend_is_call(
zend_ast *ast)
2772static inline bool zend_is_variable_or_call(
zend_ast *ast)
2774 return zend_is_variable(ast) || zend_is_call(ast);
2778static inline bool zend_is_unticked_stmt(
zend_ast *ast)
2786static inline bool zend_can_write_to_variable(
zend_ast *ast)
2792 ast = ast->
child[0];
2795 return zend_is_variable_or_call(ast) && !zend_ast_is_short_circuited(ast);
2799static inline bool zend_is_const_default_class_ref(
zend_ast *name_ast)
2809static inline void zend_handle_numeric_op(
znode *node)
2822static inline void zend_handle_numeric_dim(
zend_op *opline,
znode *dim_node)
2831 int c = zend_add_literal(&dim_node->
u.
constant);
2841static inline void zend_set_class_name_op1(
zend_op *opline,
znode *class_node)
2845 opline->
op1.
constant = zend_add_class_name_literal(
2853static void zend_compile_class_ref(
znode *
result,
zend_ast *name_ast, uint32_t fetch_flags)
2855 uint32_t fetch_type;
2860 zend_compile_expr(&name_node, name_ast);
2876 zend_ensure_valid_class_fetch_type(fetch_type);
2878 result->u.op.num = fetch_type | fetch_flags;
2892 ZVAL_STR(&
result->u.constant, zend_resolve_class_name_ast(name_ast));
2899 ZVAL_STR(&
result->u.constant, zend_resolve_class_name_ast(name_ast));
2901 zend_ensure_valid_class_fetch_type(fetch_type);
2903 result->u.op.num = fetch_type | fetch_flags;
2912 zval *
zv = zend_ast_get_zval(name_ast);
2945 zend_compile_expr(&name_node, name_ast);
2964 zend_adjust_for_fetch_type(opline,
result,
type);
2969static bool is_this_fetch(
zend_ast *ast)
2980static bool is_globals_fetch(
const zend_ast *ast)
2990static bool is_global_var_fetch(
zend_ast *ast)
2995static bool this_guaranteed_exists(
void)
3004 }
else if (op_array->
scope) {
3017 if (is_this_fetch(ast)) {
3025 }
else if (is_globals_fetch(ast)) {
3033 return zend_compile_simple_var_no_cv(
result, ast,
type, delayed);
3039static void zend_separate_if_call_and_write(
znode *node,
zend_ast *ast, uint32_t
type)
3045 && zend_is_call(ast)) {
3057static inline void zend_emit_assign_znode(
zend_ast *var_ast,
znode *value_node)
3062 zend_compile_expr(&dummy_node, assign_ast);
3063 zend_do_free(&dummy_node);
3073 znode var_node, dim_node;
3075 if (is_globals_fetch(var_ast)) {
3076 if (dim_ast ==
NULL) {
3080 zend_compile_expr(&dim_node, dim_ast);
3087 zend_adjust_for_fetch_type(opline,
result,
type);
3090 zend_short_circuiting_mark_inner(var_ast);
3091 opline = zend_delayed_compile_var(&var_node, var_ast,
type, 0);
3104 zend_separate_if_call_and_write(&var_node, var_ast,
type);
3106 if (dim_ast ==
NULL) {
3115 zend_compile_expr(&dim_node, dim_ast);
3119 zend_adjust_for_fetch_type(opline,
result,
type);
3125 zend_handle_numeric_dim(opline, &dim_node);
3132 uint32_t
offset = zend_delayed_compile_begin();
3133 zend_delayed_compile_dim(
result, ast,
type, by_ref);
3134 return zend_delayed_compile_end(
offset);
3143 znode obj_node, prop_node;
3147 if (is_this_fetch(obj_ast)) {
3148 if (this_guaranteed_exists()) {
3158 zend_short_circuiting_mark_inner(obj_ast);
3159 opline = zend_delayed_compile_var(&obj_node, obj_ast,
type, 0);
3167 zend_separate_if_call_and_write(&obj_node, obj_ast,
type);
3172 uint32_t var = obj_node.
u.
op.
var;
3176 while (i > 0 && oplines[i-1].result_type ==
IS_TMP_VAR && oplines[i-1].
result.var == var) {
3179 var = oplines[i].op1.var;
3184 for (; i <
count; ++i) {
3185 if (oplines[i].opcode !=
ZEND_NOP) {
3186 opline = get_next_op();
3189 oplines[i].extended_value = opline -
CG(active_op_array)->opcodes;
3193 zend_emit_jmp_null(&obj_node,
type);
3197 zend_compile_expr(&prop_node, prop_ast);
3206 zend_adjust_for_fetch_type(opline,
result,
type);
3214 uint32_t
offset = zend_delayed_compile_begin();
3219 return zend_delayed_compile_end(
offset);
3228 znode class_node, prop_node;
3231 zend_short_circuiting_mark_inner(class_ast);
3234 zend_compile_expr(&prop_node, prop_ast);
3247 opline->
op2.
constant = zend_add_class_name_literal(
3260 zend_adjust_for_fetch_type(opline,
result,
type);
3270 if (array_style != var_ast->
attr) {
3273 }
else if (!zend_can_write_to_variable(var_ast)) {
3279static inline void zend_emit_assign_ref_znode(
zend_ast *var_ast,
znode *value_node);
3282static bool zend_propagate_list_refs(
zend_ast *ast) {
3287 for (i = 0; i < list->
children; ++i) {
3293 elem_ast->
attr = zend_propagate_list_refs(var_ast);
3295 has_refs |= elem_ast->
attr;
3305 for (uint32_t i = 0; i < list->
children; i++) {
3314static void zend_compile_list_assign(
3320 bool is_keyed = list_is_keyed(list);
3326 for (i = 0; i < list->
children; ++i) {
3329 znode fetch_result, dim_node;
3332 if (elem_ast ==
NULL) {
3335 "Cannot use empty array entries in keyed array assignment");
3343 "Spread operator is not supported in assignments");
3346 var_ast = elem_ast->
child[0];
3347 key_ast = elem_ast->
child[1];
3351 if (key_ast ==
NULL) {
3353 "Cannot mix keyed and unkeyed array entries in assignments");
3356 zend_compile_expr(&dim_node, key_ast);
3358 if (key_ast !=
NULL) {
3360 "Cannot mix keyed and unkeyed array entries in assignments");
3371 zend_verify_list_assign_target(var_ast, array_style);
3373 opline = zend_emit_op(&fetch_result,
3377 zend_handle_numeric_dim(opline, &dim_node);
3380 if (elem_ast->
attr) {
3384 zend_compile_list_assign(
NULL, var_ast, &fetch_result, var_ast->
attr);
3385 }
else if (elem_ast->
attr) {
3386 zend_emit_assign_ref_znode(var_ast, &fetch_result);
3388 zend_emit_assign_znode(var_ast, &fetch_result);
3392 if (has_elems == 0) {
3399 zend_do_free(expr_node);
3404static void zend_ensure_writable_variable(
const zend_ast *ast)
3416 if (zend_ast_is_short_circuited(ast)) {
3419 if (is_globals_fetch(ast)) {
3421 "$GLOBALS can only be modified using the $GLOBALS[$name] = $value syntax");
3434 var_ast = var_ast->
child[0];
3442 zend_string *name1 = zval_get_string(zend_ast_get_zval(var_ast->
child[0]));
3443 zend_string *name2 = zval_get_string(zend_ast_get_zval(expr_ast->
child[0]));
3444 bool result = zend_string_equals(name1, name2);
3452static void zend_compile_expr_with_potential_assign_to_self(
3454 if (zend_is_assign_to_self(var_ast, expr_ast) && !is_this_fetch(expr_ast)) {
3458 if (zend_try_compile_cv(&cv_node, expr_ast) ==
FAILURE) {
3459 zend_compile_simple_var_no_cv(expr_node, expr_ast,
BP_VAR_R, 0);
3464 zend_compile_expr(expr_node, expr_ast);
3473 znode var_node, expr_node;
3476 if (is_this_fetch(var_ast)) {
3480 zend_ensure_writable_variable(var_ast);
3486 offset = zend_delayed_compile_begin();
3487 zend_delayed_compile_var(&var_node, var_ast,
BP_VAR_W, 0);
3488 zend_compile_expr(&expr_node, expr_ast);
3489 zend_delayed_compile_end(
offset);
3490 CG(zend_lineno) = zend_ast_get_lineno(var_ast);
3494 offset = zend_delayed_compile_begin();
3496 zend_compile_expr(&expr_node, expr_ast);
3498 opline = zend_delayed_compile_end(
offset);
3503 zend_emit_op_data(&expr_node);
3506 offset = zend_delayed_compile_begin();
3508 zend_compile_expr_with_potential_assign_to_self(&expr_node, expr_ast, var_ast);
3510 opline = zend_delayed_compile_end(
offset);
3515 opline = zend_emit_op_data(&expr_node);
3519 offset = zend_delayed_compile_begin();
3521 zend_compile_expr(&expr_node, expr_ast);
3523 opline = zend_delayed_compile_end(
offset);
3528 zend_emit_op_data(&expr_node);
3531 if (zend_propagate_list_refs(var_ast)) {
3532 if (!zend_is_variable_or_call(expr_ast)) {
3534 "Cannot assign reference to non referenceable value");
3536 zend_assert_not_short_circuited(expr_ast);
3539 zend_compile_var(&expr_node, expr_ast,
BP_VAR_W, 1);
3548 if (zend_try_compile_cv(&cv_node, expr_ast) ==
FAILURE) {
3549 zend_compile_simple_var_no_cv(&expr_node, expr_ast,
BP_VAR_R, 0);
3554 zend_compile_expr(&expr_node, expr_ast);
3558 zend_compile_list_assign(
result, var_ast, &expr_node, var_ast->
attr);
3570 znode target_node, source_node;
3574 if (is_this_fetch(target_ast)) {
3577 zend_ensure_writable_variable(target_ast);
3578 zend_assert_not_short_circuited(source_ast);
3579 if (is_globals_fetch(source_ast)) {
3583 offset = zend_delayed_compile_begin();
3584 zend_delayed_compile_var(&target_node, target_ast,
BP_VAR_W, 1);
3585 zend_compile_var(&source_node, source_ast,
BP_VAR_W, 1);
3600 opline = zend_delayed_compile_end(
offset);
3602 if (source_node.
op_type !=
IS_VAR && zend_is_call(source_ast)) {
3612 zend_emit_op_data(&source_node);
3618 zend_emit_op_data(&source_node);
3627static inline void zend_emit_assign_ref_znode(
zend_ast *var_ast,
znode *value_node)
3632 zend_compile_expr(&dummy_node, assign_ast);
3633 zend_do_free(&dummy_node);
3641 uint32_t opcode = ast->
attr;
3643 znode var_node, expr_node;
3645 uint32_t
offset, cache_slot;
3647 zend_ensure_writable_variable(var_ast);
3653 offset = zend_delayed_compile_begin();
3654 zend_delayed_compile_var(&var_node, var_ast,
BP_VAR_RW, 0);
3655 zend_compile_expr(&expr_node, expr_ast);
3656 zend_delayed_compile_end(
offset);
3661 offset = zend_delayed_compile_begin();
3663 zend_compile_expr(&expr_node, expr_ast);
3665 opline = zend_delayed_compile_end(
offset);
3672 opline = zend_emit_op_data(&expr_node);
3676 offset = zend_delayed_compile_begin();
3678 zend_compile_expr_with_potential_assign_to_self(&expr_node, expr_ast, var_ast);
3680 opline = zend_delayed_compile_end(
offset);
3686 zend_emit_op_data(&expr_node);
3690 offset = zend_delayed_compile_begin();
3692 zend_compile_expr(&expr_node, expr_ast);
3694 opline = zend_delayed_compile_end(
offset);
3701 opline = zend_emit_op_data(&expr_node);
3714 if (zend_string_equals(arg_info->
name, arg_name)) {
3722 if (zend_string_equals_cstr(arg_name, arg_info->
name,
len)) {
3729 return (uint32_t) -1;
3732static uint32_t zend_compile_args(
3737 bool uses_arg_unpack = 0;
3738 uint32_t arg_count = 0;
3742 bool uses_named_args = 0;
3744 bool may_have_undef = 0;
3746 *may_have_extra_named_args = 0;
3748 for (i = 0; i <
args->children; ++i) {
3758 if (uses_named_args) {
3760 "Cannot use argument unpacking after named arguments");
3766 *may_have_extra_named_args = 1;
3769 uses_arg_unpack = 1;
3772 zend_compile_expr(&arg_node,
arg->child[0]);
3774 opline->
op2.
num = arg_count;
3781 uses_named_args = 1;
3785 if (
fbc && !uses_arg_unpack) {
3787 if (
arg_num == arg_count + 1 && !may_have_undef) {
3795 *may_have_extra_named_args = 1;
3801 *may_have_extra_named_args = 1;
3804 if (uses_arg_unpack) {
3806 "Cannot use positional argument after argument unpacking");
3809 if (uses_named_args) {
3811 "Cannot use positional argument after named argument");
3819 if (zend_is_call(
arg) || is_globals_fetch(
arg)) {
3844 }
else if (zend_is_variable(
arg) && !zend_ast_is_short_circuited(
arg)) {
3856 CG(zend_lineno) = zend_ast_get_lineno(ast);
3857 if (is_this_fetch(
arg)) {
3862 }
else if (zend_try_compile_cv(&arg_node,
arg) ==
SUCCESS) {
3870 zend_string_addref(arg_name);
3871 opline->
op2.
constant = zend_add_literal_string(&arg_name);
3872 opline->
result.
num = zend_alloc_cache_slots(2);
3881 zend_compile_expr(&arg_node,
arg);
3915 opline = zend_emit_op(
NULL, opcode, &arg_node,
NULL);
3918 zend_string_addref(arg_name);
3919 opline->
op2.
constant = zend_add_literal_string(&arg_name);
3920 opline->
result.
num = zend_alloc_cache_slots(2);
3927 if (may_have_undef) {
3969 uint32_t opnum_init = get_next_op_number() - 1;
3972 opline = &
CG(active_op_array)->opcodes[opnum_init];
3980 opline->
op1.
num = zend_vm_calc_used_stack(0,
fbc);
3987 bool may_have_extra_named_args;
3988 uint32_t arg_count = zend_compile_args(args_ast,
fbc, &may_have_extra_named_args);
3990 zend_do_extended_fcall_begin();
3992 opline = &
CG(active_op_array)->opcodes[opnum_init];
3996 opline->
op1.
num = zend_vm_calc_used_stack(arg_count,
fbc);
4000 if (may_have_extra_named_args) {
4004 zend_do_extended_fcall_end();
4009static bool zend_compile_function_name(
znode *name_node,
zend_ast *name_ast)
4011 zend_string *orig_name = zend_ast_get_str(name_ast);
4012 bool is_fully_qualified;
4016 orig_name, name_ast->
attr, &is_fully_qualified));
4018 return !is_fully_qualified &&
FC(current_namespace);
4030 zend_op *opline = get_next_op();
4034 opline->
op1.
constant = zend_add_class_name_literal(
class);
4036 opline->
op2.
constant = zend_add_func_name_literal(method);
4038 opline->
result.
num = zend_alloc_cache_slots(2);
4041 zend_op *opline = get_next_op();
4045 opline->
op2.
constant = zend_add_func_name_literal(str);
4046 opline->
result.
num = zend_alloc_cache_slot();
4052 zend_compile_call_common(
result, args_ast,
NULL, lineno);
4059 for (i = 0; i <
args->children; ++i) {
4073 if (
args->children != 1) {
4077 zend_compile_expr(&arg_node,
args->child[0]);
4081 zval_ptr_dtor_str(&arg_node.
u.
constant);
4094 if (
args->children != 1) {
4098 zend_compile_expr(&arg_node,
args->child[0]);
4114 if (
args->children != 1) {
4118 zend_compile_expr(&arg_node,
args->child[0]);
4129 if (
args->children != 1) {
4133 zend_compile_expr(&arg_node,
args->child[0]);
4153 name = zval_get_string(zend_ast_get_zval(
args->child[0]));
4159 if (zend_try_ct_eval_const(&
result->u.constant,
name, 0)) {
4179 if (
args->children == 1 &&
4196 if (
args->children == 1 &&
4233 &&
fbc->op_array.filename != filename);
4247 name = zend_ast_get_str(name_ast);
4250 fbc = zend_hash_find_ptr(
CG(function_table),
lcname);
4252 || !fbc_is_finalized(
fbc)
4253 || zend_compile_ignore_function(
fbc,
CG(active_op_array)->filename)) {
4263 opline->
result.
num = zend_alloc_cache_slot();
4274 if (zend_try_compile_ct_bound_init_user_func(name_ast,
num_args) ==
SUCCESS) {
4278 zend_compile_expr(&name_node, name_ast);
4293 if (
args->children != 2) {
4297 zend_compile_init_user_func(
args->child[0], 0,
lcname);
4304 bool is_fully_qualified;
4305 zend_string *
name = zend_resolve_function_name(orig_name,
args->child[1]->child[0]->attr, &is_fully_qualified);
4308 && !zend_args_contain_unpack_or_named(list)
4319 zend_compile_expr(&arg_node, list->
child[0]);
4320 zend_compile_expr(&len_node, list->
child[2]);
4330 zend_compile_expr(&arg_node,
args->child[1]);
4345 if (
args->children < 1) {
4349 zend_compile_init_user_func(
args->child[0],
args->children - 1,
lcname);
4350 for (i = 1; i <
args->children; ++i) {
4355 zend_compile_expr(&arg_node, arg_ast);
4369 if (
EG(assertions) >= 0) {
4372 uint32_t check_op_number = get_next_op_number();
4376 if (
fbc && fbc_is_finalized(
fbc)) {
4386 opline->
result.
num = zend_alloc_cache_slot();
4388 if (
args->children == 1) {
4404 opline = &
CG(active_op_array)->opcodes[check_op_number];
4420 znode array, needly;
4423 if (
args->children == 3) {
4429 bool is_fully_qualified;
4430 zend_string *resolved_name = zend_resolve_const_name(
4431 zend_ast_get_str(name_ast), name_ast->
attr, &is_fully_qualified);
4433 if (!zend_try_ct_eval_const(&
value, resolved_name, is_fully_qualified)) {
4444 }
else if (
args->children != 2) {
4449 || !zend_try_ct_eval_array(&array.
u.
constant,
args->child[1])) {
4493 zend_compile_expr(&needly,
args->child[0]);
4507 if (
args->children != 1) {
4511 zend_compile_expr(&arg_node,
args->child[0]);
4521 if (
args->children == 0) {
4526 if (
args->children != 1) {
4530 zend_compile_expr(&arg_node,
args->child[0]);
4539 if (
args->children != 0) {
4552 if (
args->children != 1) {
4556 zend_compile_expr(&arg_node,
args->child[0]);
4564 if (
CG(active_op_array)->function_name &&
args->children == 0) {
4575 if (
CG(active_op_array)->function_name &&
args->children == 0) {
4586 znode subject, needle;
4588 if (
args->children != 2) {
4592 zend_compile_expr(&needle,
args->child[0]);
4593 zend_compile_expr(&subject,
args->child[1]);
4602 if (
CG(active_op_array)->function_name
4603 &&
args->children == 2
4611 bool is_fully_qualified;
4612 zend_string *
name = zend_resolve_function_name(orig_name,
args->child[0]->child[0]->attr, &is_fully_qualified);
4614 zval *
zv = zend_ast_get_zval(
args->child[1]);
4633static uint32_t find_frameless_function_offset(uint32_t arity,
void *
handler)
4644 return (uint32_t)-1;
4662 if (!frameless_function_info) {
4666 if (
args->children > 3) {
4670 while (frameless_function_info->
handler) {
4671 if (frameless_function_info->
num_args >=
args->children
4672 &&
fbc->common.required_num_args <=
args->children
4674 || frameless_function_info->
num_args ==
args->children)) {
4677 if (
offset == (uint32_t)-1) {
4680 return frameless_function_info;
4682 frameless_function_info++;
4690 int lineno =
CG(zend_lineno);
4694 for (uint32_t i = 0; i <
num_args; i++) {
4695 if (i < args->children) {
4696 zend_compile_expr(&arg_zvs[i],
args->child[i]);
4706 uint32_t opnum = get_next_op_number();
4717 zend_emit_op_data(&arg_zvs[2]);
4725 if (!frameless_function_info) {
4726 return (uint32_t)-1;
4729 return zend_compile_frameless_icall_ex(
result,
args,
fbc, frameless_function_info,
type);
4734 int name_constants = zend_add_ns_func_name_literal(
Z_STR(name_node->
u.
constant));
4739 && !zend_args_contain_unpack_or_named(zend_ast_get_list(args_ast))
4741 && !
CG(
context).in_jmp_frameless_branch) {
4743 frameless_function = zend_hash_find_ptr(
CG(function_table), lc_func_name);
4747 uint32_t jmp_fl_opnum = 0;
4749 if (frameless_function) {
4750 frameless_function_info = find_frameless_function_info(zend_ast_get_list(args_ast), frameless_function,
type);
4751 if (frameless_function_info) {
4752 CG(
context).in_jmp_frameless_branch =
true;
4756 jmp_fl_opnum = get_next_op_number();
4762 zend_op *opline = get_next_op();
4766 opline->
result.
num = zend_alloc_cache_slot();
4767 zend_compile_call_common(
result, args_ast,
NULL, lineno);
4770 if (frameless_function_info) {
4771 CG(zend_lineno) = lineno;
4773 uint32_t jmp_end_opnum = zend_emit_jump(0);
4774 uint32_t jmp_fl_target = get_next_op_number();
4776 uint32_t flf_icall_opnum = zend_compile_frameless_icall_ex(
NULL, zend_ast_get_list(args_ast), frameless_function, frameless_function_info,
type);
4778 zend_op *jmp_fl = &
CG(active_op_array)->opcodes[jmp_fl_opnum];
4781 zend_op *flf_icall = &
CG(active_op_array)->opcodes[flf_icall_opnum];
4783 zend_update_jump_target_to_next(jmp_end_opnum);
4785 CG(
context).in_jmp_frameless_branch =
false;
4797 if (
args->children < 1) {
4801 zend_eval_const_expr(&
args->child[0]);
4807 zval *format_string = zend_ast_get_zval(
args->child[0]);
4817 uint32_t placeholder_count;
4819 placeholder_count = 0;
4824 p = memchr(
p,
'%',
end -
p);
4837 placeholder_count++;
4850 if (placeholder_count != (
args->children - 1)) {
4864 if (placeholder_count > 0) {
4865 elements =
safe_emalloc(
sizeof(*elements), placeholder_count, 0);
4871 for (uint32_t i = 0; i < placeholder_count; i++) {
4872 zend_compile_expr(elements + i,
args->child[1 + i]);
4875 uint32_t rope_elements = 0;
4876 uint32_t rope_init_lineno = -1;
4879 placeholder_count = 0;
4884 p = memchr(
p,
'%',
end -
p);
4905 if (rope_elements == 0) {
4906 rope_init_lineno = get_next_op_number();
4908 opline = zend_compile_rope_add(
result, rope_elements++, &const_node);
4917 if (elements[placeholder_count].op_type ==
IS_CONST) {
4919 zend_emit_op_tmp(&elements[placeholder_count],
ZEND_CAST, &elements[placeholder_count],
NULL)->extended_value =
IS_STRING;
4926 zend_emit_op_tmp(&elements[placeholder_count],
ZEND_CAST, &elements[placeholder_count],
NULL)->extended_value =
IS_LONG;
4931 if (rope_elements == 0) {
4932 rope_init_lineno = get_next_op_number();
4934 opline = zend_compile_rope_add(
result, rope_elements++, &elements[placeholder_count]);
4936 placeholder_count++;
4948 if (rope_elements == 0) {
4949 rope_init_lineno = get_next_op_number();
4951 opline = zend_compile_rope_add(
result, rope_elements++, &const_node);
4955 zend_op *init_opline =
CG(active_op_array)->opcodes + rope_init_lineno;
4956 zend_compile_rope_finalize(
result, rope_elements, init_opline, opline);
4965 return zend_compile_func_strlen(
result,
args);
4988 return zend_compile_func_is_scalar(
result,
args);
5000 return zend_compile_func_defined(
result,
args);
5010 return zend_compile_func_in_array(
result,
args);
5015 return zend_compile_func_get_class(
result,
args);
5017 return zend_compile_func_get_called_class(
result,
args);
5019 return zend_compile_func_gettype(
result,
args);
5021 return zend_compile_func_num_args(
result,
args);
5023 return zend_compile_func_get_args(
result,
args);
5025 return zend_compile_func_array_slice(
result,
args);
5027 return zend_compile_func_array_key_exists(
result,
args);
5029 return zend_compile_func_sprintf(
result,
args);
5047 if (zend_args_contain_unpack_or_named(
args)) {
5070 if (
ZSTR_VAL(prop_name)[0] !=
'\0') {
5071 return zend_string_copy(prop_name);
5073 const char *unmangled = zend_get_unmangled_property_name(prop_name);
5074 return zend_string_init(unmangled,
strlen(unmangled),
false);
5109 zval *property_hook_name_zv = zend_ast_get_zval(class_ast->
child[1]);
5110 zend_string *property_name = zval_get_string(property_hook_name_zv);
5111 zend_string *hook_name = zend_ast_get_str(method_ast);
5121 const char *unmangled_prop_name = zend_get_unmangled_property_name(
prop_info->name);
5122 if (!zend_string_equals_cstr(property_name, unmangled_prop_name,
strlen(unmangled_prop_name))) {
5126 if (hook_kind !=
CG(
context).active_property_hook_kind) {
5128 ZSTR_VAL(property_name),
ZSTR_VAL(hook_name), zend_get_cstring_from_property_hook_kind(
CG(
context).active_property_hook_kind));
5131 zend_op *opline = get_next_op();
5134 opline->
op1.
constant = zend_add_literal_string(&property_name);
5135 opline->
op2.
num = hook_kind;
5138 zend_compile_call_common(
result, args_ast,
fbc, zend_ast_get_lineno(method_ast));
5152 zend_compile_expr(&name_node, name_ast);
5153 zend_compile_dynamic_call(
result, &name_node, args_ast, ast->
lineno);
5158 bool runtime_resolution = zend_compile_function_name(&name_node, name_ast);
5159 if (runtime_resolution) {
5161 && !is_callable_convert) {
5183 zend_string_release(
lcname);
5189 || !fbc_is_finalized(
fbc)
5190 || zend_compile_ignore_function(
fbc,
CG(active_op_array)->filename)) {
5192 zend_compile_dynamic_call(
result, &name_node, args_ast, ast->
lineno);
5196 if (!is_callable_convert &&
5209 opline->
result.
num = zend_alloc_cache_slot();
5228 znode obj_node, method_node;
5232 uint32_t short_circuiting_checkpoint = zend_short_circuiting_checkpoint();
5234 if (is_this_fetch(obj_ast)) {
5235 if (this_guaranteed_exists()) {
5245 zend_short_circuiting_mark_inner(obj_ast);
5246 zend_compile_expr(&obj_node, obj_ast);
5248 zend_emit_jmp_null(&obj_node,
type);
5252 zend_compile_expr(&method_node, method_ast);
5261 opline->
op2.
constant = zend_add_func_name_literal(
5263 opline->
result.
num = zend_alloc_cache_slots(2);
5270 CG(active_class_entry) && zend_is_scope_known()) {
5272 fbc = zend_hash_find_ptr(&
CG(active_class_entry)->function_table,
lcname);
5281 if (zend_compile_call_common(
result, args_ast,
fbc, zend_ast_get_lineno(method_ast))) {
5282 if (short_circuiting_checkpoint != zend_short_circuiting_checkpoint()) {
5284 "Cannot combine nullsafe operator with Closure creation");
5320 znode class_node, method_node;
5324 if (zend_compile_parent_property_hook_call(
result, ast,
type)) {
5328 zend_short_circuiting_mark_inner(class_ast);
5331 zend_compile_expr(&method_node, method_ast);
5344 opline = get_next_op();
5347 zend_set_class_name_op1(opline, &class_node);
5351 opline->
op2.
constant = zend_add_func_name_literal(
5353 opline->
result.
num = zend_alloc_cache_slots(2);
5356 opline->
result.
num = zend_alloc_cache_slot();
5366 ce = zend_hash_find_ptr(
CG(class_table),
lcname);
5368 if (zend_compile_ignore_class(ce,
CG(active_op_array)->filename)) {
5371 }
else if (
CG(active_class_entry)
5373 ce =
CG(active_class_entry);
5377 && zend_is_scope_known()) {
5378 ce =
CG(active_class_entry);
5382 fbc = zend_get_compatible_func_or_null(ce,
lcname);
5386 zend_compile_call_common(
result, args_ast,
fbc, zend_ast_get_lineno(method_ast));
5397 znode class_node, ctor_result;
5402 zend_compile_class_decl(&class_node, class_ast, 0);
5411 opline->
op1.
constant = zend_add_class_name_literal(
5413 opline->
op2.
num = zend_alloc_cache_slot();
5418 zend_compile_call_common(&ctor_result, args_ast,
NULL, ast->
lineno);
5419 zend_do_free(&ctor_result);
5428 zend_compile_expr(&obj_node, obj_ast);
5434static void zend_compile_global_var(
zend_ast *ast)
5441 zend_compile_expr(&name_node, name_ast);
5447 if (is_this_fetch(var_ast)) {
5449 }
else if (zend_try_compile_cv(&
result, var_ast) ==
SUCCESS) {
5463 zend_emit_assign_ref_znode(
5474 if (!
CG(active_op_array)->static_variables) {
5475 if (
CG(active_op_array)->
scope) {
5494static void zend_compile_static_var(
zend_ast *ast)
5503 if (!
CG(active_op_array)->static_variables) {
5504 if (
CG(active_op_array)->
scope) {
5510 if (zend_hash_exists(
CG(active_op_array)->static_variables,
var_name)) {
5514 zend_eval_const_expr(&ast->
child[1]);
5518 zval *value_zv = value_ast
5519 ? zend_ast_get_zval(value_ast)
5520 : &
EG(uninitialized_zval);
5527 uint32_t placeholder_offset = (uint32_t)((
char*)placeholder_ptr - (
char*)
CG(active_op_array)->static_variables->arData);
5529 uint32_t static_def_jmp_opnum = get_next_op_number();
5536 zend_compile_expr(&expr, value_ast);
5543 zend_update_jump_target_to_next(static_def_jmp_opnum);
5548static void zend_compile_unset(
zend_ast *ast)
5554 zend_ensure_writable_variable(var_ast);
5556 if (is_global_var_fetch(var_ast)) {
5557 if (!var_ast->
child[1]) {
5561 zend_compile_expr(&var_node, var_ast->
child[1]);
5571 switch (var_ast->
kind) {
5573 if (is_this_fetch(var_ast)) {
5575 }
else if (zend_try_compile_cv(&var_node, var_ast) ==
SUCCESS) {
5609 for (; loop_var >= base; loop_var--) {
5611 zend_op *opline = get_next_op();
5621 zend_op *opline = get_next_op();
5628 }
else if (depth <= 1) {
5637 opline = get_next_op();
5645 return (depth == 0);
5655static bool zend_has_finally_ex(
zend_long depth)
5664 for (; loop_var >= base; loop_var--) {
5671 }
else if (depth <= 1) {
5681static bool zend_has_finally(
void)
5687static void zend_compile_return(
zend_ast *ast)
5704 }
else if (by_ref && zend_is_variable(expr_ast)) {
5705 zend_assert_not_short_circuited(expr_ast);
5706 zend_compile_var(&expr_node, expr_ast,
BP_VAR_W, 1);
5708 zend_compile_expr(&expr_node, expr_ast);
5713 && zend_has_finally()) {
5724 zend_emit_return_type_check(
5725 expr_ast ? &expr_node :
NULL,
CG(active_op_array)->arg_info - 1, 0);
5733 if (by_ref && expr_ast) {
5734 if (zend_is_call(expr_ast)) {
5736 }
else if (!zend_is_variable(expr_ast) || zend_ast_is_short_circuited(expr_ast)) {
5743static void zend_compile_echo(
zend_ast *ast)
5749 zend_compile_expr(&expr_node, expr_ast);
5761 zend_compile_expr(&expr_node, expr_ast);
5773static void zend_compile_break_continue(
zend_ast *ast)
5789 depth_zv = zend_ast_get_zval(depth_ast);
5800 if (
CG(
context).current_brk_cont == -1) {
5804 if (!zend_handle_loops_and_finally_ex(depth,
NULL)) {
5807 depth, depth == 1 ?
"" :
"s");
5812 int d, cur =
CG(
context).current_brk_cont;
5813 for (d = depth - 1; d > 0; d--) {
5814 cur =
CG(
context).brk_cont_array[cur].parent;
5818 if (
CG(
context).brk_cont_array[cur].is_switch) {
5820 if (
CG(
context).brk_cont_array[cur].parent == -1) {
5822 "\"continue\" targeting switch is equivalent to \"break\"");
5825 "\"continue\" targeting switch is equivalent to \"break\". " \
5830 if (
CG(
context).brk_cont_array[cur].parent == -1) {
5838 depth, depth, depth + 1);
5855 uint32_t opnum = opline - op_array->
opcodes;
5861 CG(in_compilation) = 1;
5862 CG(active_op_array) = op_array;
5867 zval_ptr_dtor_str(label);
5873 CG(in_compilation) = 1;
5874 CG(active_op_array) = op_array;
5885 if (elem->
try_op > opnum) {
5888 if (elem->
finally_op && opnum < elem->finally_op - 1
5903 while (remove_oplines--) {
5911static void zend_compile_goto(
zend_ast *ast)
5917 zend_compile_expr(&label_node, label_ast);
5920 uint32_t opnum_start = get_next_op_number();
5921 zend_handle_loops_and_finally(
NULL);
5923 opline->
op1.
num = get_next_op_number() - opnum_start - 1;
5928static void zend_compile_label(
zend_ast *ast)
5947static void zend_compile_while(
zend_ast *ast)
5952 uint32_t opnum_start, opnum_jmp, opnum_cond;
5954 opnum_jmp = zend_emit_jump(0);
5958 opnum_start = get_next_op_number();
5959 zend_compile_stmt(stmt_ast);
5961 opnum_cond = get_next_op_number();
5962 zend_update_jump_target(opnum_jmp, opnum_cond);
5963 zend_compile_expr(&cond_node, cond_ast);
5965 zend_emit_cond_jump(
ZEND_JMPNZ, &cond_node, opnum_start);
5967 zend_end_loop(opnum_cond,
NULL);
5971static void zend_compile_do_while(
zend_ast *ast)
5977 uint32_t opnum_start, opnum_cond;
5981 opnum_start = get_next_op_number();
5982 zend_compile_stmt(stmt_ast);
5984 opnum_cond = get_next_op_number();
5985 zend_compile_expr(&cond_node, cond_ast);
5987 zend_emit_cond_jump(
ZEND_JMPNZ, &cond_node, opnum_start);
5989 zend_end_loop(opnum_cond,
NULL);
6005 list = zend_ast_get_list(ast);
6006 for (i = 0; i < list->
children; ++i) {
6010 zend_compile_expr(
result, expr_ast);
6015static void zend_compile_for(
zend_ast *ast)
6023 uint32_t opnum_start, opnum_jmp, opnum_loop;
6025 zend_compile_expr_list(&
result, init_ast);
6028 opnum_jmp = zend_emit_jump(0);
6032 opnum_start = get_next_op_number();
6033 zend_compile_stmt(stmt_ast);
6035 opnum_loop = get_next_op_number();
6036 zend_compile_expr_list(&
result, loop_ast);
6039 zend_update_jump_target_to_next(opnum_jmp);
6040 zend_compile_expr_list(&
result, cond_ast);
6041 zend_do_extended_stmt();
6045 zend_end_loop(opnum_loop,
NULL);
6049static void zend_compile_foreach(
zend_ast *ast)
6056 bool is_variable = zend_is_variable(expr_ast) && zend_can_write_to_variable(expr_ast);
6058 znode expr_node, reset_node, value_node, key_node;
6060 uint32_t opnum_reset, opnum_fetch;
6072 value_ast = value_ast->
child[0];
6079 if (by_ref && is_variable) {
6080 zend_compile_var(&expr_node, expr_ast,
BP_VAR_W, 1);
6082 zend_compile_expr(&expr_node, expr_ast);
6086 zend_separate_if_call_and_write(&expr_node, expr_ast,
BP_VAR_W);
6089 opnum_reset = get_next_op_number();
6094 opnum_fetch = get_next_op_number();
6097 if (is_this_fetch(value_ast)) {
6100 zend_try_compile_cv(&value_node, value_ast) ==
SUCCESS) {
6104 opline->
op2.
var = get_temporary_variable();
6107 zend_compile_list_assign(
NULL, value_ast, &value_node, value_ast->
attr);
6108 }
else if (by_ref) {
6109 zend_emit_assign_ref_znode(value_ast, &value_node);
6111 zend_emit_assign_znode(value_ast, &value_node);
6116 opline = &
CG(active_op_array)->opcodes[opnum_fetch];
6117 zend_make_tmp_result(&key_node, opline);
6118 zend_emit_assign_znode(key_ast, &key_node);
6121 zend_compile_stmt(stmt_ast);
6127 zend_emit_jump(opnum_fetch);
6129 opline = &
CG(active_op_array)->opcodes[opnum_reset];
6132 opline = &
CG(active_op_array)->opcodes[opnum_fetch];
6135 zend_end_loop(opnum_fetch, &reset_node);
6141static void zend_compile_if(
zend_ast *ast)
6145 uint32_t *jmp_opnums =
NULL;
6151 for (i = 0; i < list->
children; ++i) {
6158 uint32_t opnum_jmpz;
6161 CG(zend_lineno) = cond_ast->
lineno;
6162 zend_do_extended_stmt();
6165 zend_compile_expr(&cond_node, cond_ast);
6166 opnum_jmpz = zend_emit_cond_jump(
ZEND_JMPZ, &cond_node, 0);
6168 zend_compile_stmt(stmt_ast);
6173 CG(zend_lineno) = elem_ast->
lineno;
6174 jmp_opnums[i] = zend_emit_jump(0);
6176 zend_update_jump_target_to_next(opnum_jmpz);
6180 zend_compile_stmt(stmt_ast);
6185 for (i = 0; i < list->
children - 1; ++i) {
6186 zend_update_jump_target_to_next(jmp_opnums[i]);
6193static uint8_t determine_switch_jumptable_type(
zend_ast_list *cases) {
6196 for (i = 0; i < cases->
children; i++) {
6200 if (!case_ast->
child[0]) {
6205 zend_eval_const_expr(cond_ast);
6211 cond_zv = zend_ast_get_zval(case_ast->
child[0]);
6219 }
else if (common_type !=
Z_TYPE_P(cond_zv)) {
6234static bool should_use_jumptable(
zend_ast_list *cases, uint8_t jumptable_type) {
6241 if (jumptable_type ==
IS_LONG) {
6249static void zend_compile_switch(
zend_ast *ast)
6255 bool has_default_case = 0;
6257 znode expr_node, case_node;
6259 uint32_t *jmpnz_opnums, opnum_default_jmp, opnum_switch = (uint32_t)-1;
6260 uint8_t jumptable_type;
6263 zend_compile_expr(&expr_node, expr_ast);
6265 zend_begin_loop(
ZEND_FREE, &expr_node, 1);
6268 case_node.
u.
op.
var = get_temporary_variable();
6270 jumptable_type = determine_switch_jumptable_type(cases);
6271 if (jumptable_type !=
IS_UNDEF && should_use_jumptable(cases, jumptable_type)) {
6279 opline = zend_emit_op(
NULL,
6281 &expr_node, &jumptable_op);
6285 opnum_switch = opline -
CG(active_op_array)->opcodes;
6289 for (i = 0; i < cases->
children; ++i) {
6295 if (has_default_case) {
6296 CG(zend_lineno) = case_ast->
lineno;
6298 "Switch statements may only contain one default clause");
6300 has_default_case = 1;
6304 zend_compile_expr(&cond_node, cond_ast);
6308 jmpnz_opnums[i] = zend_emit_cond_jump(
ZEND_JMPZ, &cond_node, 0);
6311 jmpnz_opnums[i] = zend_emit_cond_jump(
ZEND_JMPNZ, &cond_node, 0);
6313 opline = zend_emit_op(
NULL,
6315 &expr_node, &cond_node);
6321 jmpnz_opnums[i] = zend_emit_cond_jump(
ZEND_JMPNZ, &case_node, 0);
6325 opnum_default_jmp = zend_emit_jump(0);
6327 for (i = 0; i < cases->
children; ++i) {
6333 zend_update_jump_target_to_next(jmpnz_opnums[i]);
6336 zval *cond_zv = zend_ast_get_zval(cond_ast);
6338 ZVAL_LONG(&jmp_target, get_next_op_number());
6349 zend_update_jump_target_to_next(opnum_default_jmp);
6353 opline = &
CG(active_op_array)->opcodes[opnum_switch];
6358 zend_compile_stmt(stmt_ast);
6361 if (!has_default_case) {
6362 zend_update_jump_target_to_next(opnum_default_jmp);
6365 opline = &
CG(active_op_array)->opcodes[opnum_switch];
6370 zend_end_loop(get_next_op_number(), &expr_node);
6376 zval_ptr_dtor_nogc(&expr_node.
u.
constant);
6379 efree(jmpnz_opnums);
6385 uint32_t num_conds = 0;
6387 for (uint32_t i = 0; i < arms->
children; i++) {
6401 for (uint32_t i = 0; i < arms->
children; i++) {
6403 if (!arm_ast->
child[0]) {
6412 zend_eval_const_expr(cond_ast);
6417 zval *cond_zv = zend_ast_get_zval(*cond_ast);
6431 bool has_default_arm = 0;
6432 uint32_t opnum_match = (uint32_t)-1;
6435 zend_compile_expr(&expr_node, expr_ast);
6439 case_node.
u.
op.
var = get_temporary_variable();
6441 uint32_t num_conds = count_match_conds(arms);
6442 uint8_t can_use_jumptable = can_match_use_jumptable(arms);
6443 bool uses_jumptable = can_use_jumptable && num_conds >= 2;
6445 uint32_t *jmpnz_opnums =
NULL;
6447 for (uint32_t i = 0; i < arms->
children; ++i) {
6450 if (!arm_ast->
child[0]) {
6451 if (has_default_arm) {
6454 "Match expressions may only contain one default arm");
6456 has_default_arm = 1;
6460 if (uses_jumptable) {
6472 opnum_match = opline -
CG(active_op_array)->opcodes;
6474 jmpnz_opnums =
safe_emalloc(
sizeof(uint32_t), num_conds, 0);
6475 uint32_t cond_count = 0;
6476 for (uint32_t i = 0; i < arms->
children; ++i) {
6479 if (!arm_ast->
child[0]) {
6488 zend_compile_expr(&cond_node, cond_ast);
6491 zend_op *opline = zend_emit_op(
NULL, opcode, &expr_node, &cond_node);
6497 jmpnz_opnums[cond_count] = zend_emit_cond_jump(
ZEND_JMPNZ, &case_node, 0);
6504 uint32_t opnum_default_jmp = 0;
6505 if (!uses_jumptable) {
6506 opnum_default_jmp = zend_emit_jump(0);
6509 bool is_first_case = 1;
6510 uint32_t cond_count = 0;
6515 if (!has_default_arm) {
6516 if (!uses_jumptable) {
6517 zend_update_jump_target_to_next(opnum_default_jmp);
6521 zend_op *opline = &
CG(active_op_array)->opcodes[opnum_match];
6535 for (uint32_t i = 0; i < arms->
children; ++i) {
6545 if (jmpnz_opnums !=
NULL) {
6546 zend_update_jump_target_to_next(jmpnz_opnums[cond_count]);
6550 zval *cond_zv = zend_ast_get_zval(cond_ast);
6552 ZVAL_LONG(&jmp_target, get_next_op_number());
6565 if (!uses_jumptable) {
6566 zend_update_jump_target_to_next(opnum_default_jmp);
6571 zend_op *opline = &
CG(active_op_array)->opcodes[opnum_match];
6577 zend_compile_expr(&body_node, body_ast);
6579 if (is_first_case) {
6587 jmp_end_opnums[i] = zend_emit_jump(0);
6596 for (uint32_t i = 0; i < arms->
children; ++i) {
6597 zend_update_jump_target_to_next(jmp_end_opnums[i]);
6604 zval_ptr_dtor_nogc(&expr_node.
u.
constant);
6607 if (jmpnz_opnums !=
NULL) {
6608 efree(jmpnz_opnums);
6610 efree(jmp_end_opnums);
6613static void zend_compile_try(
zend_ast *ast)
6621 uint32_t try_catch_offset;
6623 uint32_t orig_fast_call_var =
CG(
context).fast_call_var;
6624 uint32_t orig_try_catch_offset =
CG(
context).try_catch_offset;
6626 if (catches->
children == 0 && !finally_ast) {
6634 if (label->
opline_num == get_next_op_number()) {
6641 try_catch_offset = zend_add_try_element(get_next_op_number());
6648 CG(
context).fast_call_var = get_temporary_variable();
6658 CG(
context).try_catch_offset = try_catch_offset;
6660 zend_compile_stmt(try_ast);
6663 jmp_opnums[0] = zend_emit_jump(0);
6666 for (i = 0; i < catches->
children; ++i) {
6672 bool is_last_catch = (i + 1 == catches->
children);
6674 uint32_t *jmp_multicatch =
safe_emalloc(
sizeof(uint32_t), classes->children - 1, 0);
6675 uint32_t opnum_catch = (uint32_t)-1;
6677 CG(zend_lineno) = catch_ast->
lineno;
6679 for (
j = 0;
j < classes->children;
j++) {
6681 bool is_last_class = (
j + 1 == classes->children);
6683 if (!zend_is_const_default_class_ref(class_ast)) {
6687 opnum_catch = get_next_op_number();
6688 if (i == 0 &&
j == 0) {
6689 CG(active_op_array)->try_catch_array[try_catch_offset].catch_op = opnum_catch;
6692 opline = get_next_op();
6695 opline->
op1.
constant = zend_add_class_name_literal(
6696 zend_resolve_class_name_ast(class_ast));
6706 if (is_last_catch && is_last_class) {
6710 if (!is_last_class) {
6711 jmp_multicatch[
j] = zend_emit_jump(0);
6712 opline = &
CG(active_op_array)->opcodes[opnum_catch];
6717 for (
j = 0;
j < classes->children - 1;
j++) {
6718 zend_update_jump_target_to_next(jmp_multicatch[
j]);
6721 efree(jmp_multicatch);
6723 zend_compile_stmt(stmt_ast);
6725 if (!is_last_catch) {
6726 jmp_opnums[i + 1] = zend_emit_jump(0);
6729 ZEND_ASSERT(opnum_catch != (uint32_t)-1 &&
"Should have at least one class");
6730 opline = &
CG(active_op_array)->opcodes[opnum_catch];
6731 if (!is_last_catch) {
6736 for (i = 0; i < catches->
children; ++i) {
6737 zend_update_jump_target_to_next(jmp_opnums[i]);
6742 uint32_t opnum_jmp = get_next_op_number() + 1;
6753 CG(zend_lineno) = finally_ast->
lineno;
6756 opline->
op1.
num = try_catch_offset;
6762 zend_compile_stmt(finally_ast);
6764 CG(active_op_array)->try_catch_array[try_catch_offset].finally_op = opnum_jmp + 1;
6765 CG(active_op_array)->try_catch_array[try_catch_offset].finally_end
6766 = get_next_op_number();
6771 opline->
op2.
num = orig_try_catch_offset;
6773 zend_update_jump_target_to_next(opnum_jmp);
6775 CG(
context).fast_call_var = orig_fast_call_var;
6781 CG(
context).try_catch_offset = orig_try_catch_offset;
6792 for (i = 0; i < declares->
children; ++i) {
6804 if (
CG(multibyte)) {
6805 zend_string *encoding_name = zval_get_string(zend_ast_get_zval(value_ast));
6810 CG(encoding_declared) = 1;
6813 if (!new_encoding) {
6816 old_input_filter =
LANG_SCNG(input_filter);
6817 old_encoding =
LANG_SCNG(script_encoding);
6821 if (old_input_filter !=
LANG_SCNG(input_filter) ||
6822 (old_input_filter && new_encoding != old_encoding)) {
6830 "Zend multibyte feature is turned off by settings");
6845 while (i < file_ast->children) {
6846 if (file_ast->
child[i] == ast) {
6848 }
else if (file_ast->
child[i] ==
NULL) {
6861static void zend_compile_declare(
zend_ast *ast)
6868 for (i = 0; i < declares->
children; ++i) {
6881 FC(declarables).ticks = zval_get_long(&value_zv);
6882 zval_ptr_dtor_nogc(&value_zv);
6885 if (
FAILURE == zend_is_first_statement(ast, 0)) {
6887 "the very first statement in the script");
6892 if (
FAILURE == zend_is_first_statement(ast, 0)) {
6894 "the very first statement in the script");
6908 if (
Z_LVAL(value_zv) == 1) {
6918 zend_compile_stmt(stmt_ast);
6920 FC(declarables) = orig_declarables;
6925static void zend_compile_stmt_list(
zend_ast *ast)
6929 for (i = 0; i < list->
children; ++i) {
6930 zend_compile_stmt(list->
child[i]);
6939 func->common.arg_flags[0] = 0;
6940 func->common.arg_flags[1] = 0;
6941 func->common.arg_flags[2] = 0;
6942 if (
func->common.arg_info) {
6964 if (ast->
attr ==
IS_STATIC && !
CG(active_class_entry) && zend_is_scope_known()) {
6966 "Cannot use \"static\" when no class scope is active");
6972 uint8_t type_code = zend_lookup_builtin_type_by_name(class_name);
6974 if (type_code != 0) {
6977 "Type declaration '%s' must be unqualified",
6978 ZSTR_VAL(zend_string_tolower(class_name)));
6991 const char *correct_name;
6993 uint32_t fetch_type = zend_get_class_fetch_type_ast(ast);
6995 class_name = zend_resolve_class_name_ast(ast);
6998 zend_ensure_valid_class_fetch_type(fetch_type);
6999 zend_string_addref(class_name);
7003 && zend_is_confusable_type(orig_name, &correct_name)
7004 && zend_is_not_imported(orig_name)) {
7006 FC(current_namespace) ?
" or import the class with \"use\"" :
"";
7009 "\"%s\" will be interpreted as a class name. Did you mean \"%s\"? "
7010 "Write \"\\%s\"%s to suppress this warning",
7014 "\"%s\" is not a supported builtin type "
7015 "and will be interpreted as a class name. "
7016 "Write \"\\%s\"%s to suppress this warning",
7028static void zend_are_intersection_types_redundant(
zend_type left_type,
zend_type right_type)
7035 bool flipped =
false;
7038 smaller_type_list = r_type_list;
7039 larger_type_list = l_type_list;
7042 smaller_type_list = l_type_list;
7043 larger_type_list = r_type_list;
7046 unsigned int sum = 0;
7058 if (sum == smaller_type_list->
num_types) {
7078static void zend_is_intersection_type_redundant_by_single_type(
zend_type intersection_type,
zend_type single_type)
7098 for (
size_t i = 0; i < type_list->
num_types - 1; i++) {
7100 zend_is_intersection_type_redundant_by_single_type(type_list->
types[i],
type);
7112static zend_type zend_compile_typename_ex(
7113 zend_ast *ast,
bool force_allow_null,
bool *forced_allow_null)
7119 if (is_marked_nullable) {
7126 bool is_composite =
false;
7127 bool has_only_iterable_class =
true;
7133 for (uint32_t i = 0; i < list->
children; i++) {
7139 has_only_iterable_class =
false;
7140 is_composite =
true;
7151 single_type = zend_compile_typename(type_ast);
7157 for (
size_t i = 0; i < type_list->
num_types - 1; i++) {
7159 zend_are_intersection_types_redundant(single_type, type_list->
types[i]);
7163 zend_is_intersection_type_redundant_by_single_type(single_type, type_list->
types[i]);
7168 single_type = zend_compile_single_typename(type_ast);
7175 has_only_iterable_class =
false;
7179 if (type_mask_overlap) {
7183 "Duplicate type %s is redundant",
ZSTR_VAL(overlap_type_str));
7189 "Type contains both true and false, bool must be used instead");
7211 zend_is_type_list_redundant_by_single_type(type_list, single_type);
7233 "Type %s contains both object and a class type, which is redundant",
7247 for (uint32_t i = 0; i < list->
children; i++) {
7249 zend_type single_type = zend_compile_single_typename(type_ast);
7256 "Type %s cannot be part of an intersection type",
ZSTR_VAL(standard_type_str));
7263 "Type %s cannot be part of an intersection type",
ZSTR_VAL(standard_type_str));
7277 zend_is_type_list_redundant_by_single_type(type_list, single_type);
7283 if (force_allow_null) {
7291 dnf_type_list->
types[0] = intersection_type;
7303 type = zend_compile_single_typename(ast);
7308 if (type_mask ==
MAY_BE_ANY && is_marked_nullable) {
7312 if ((type_mask &
MAY_BE_NULL) && is_marked_nullable) {
7316 if (force_allow_null && !is_marked_nullable && !(type_mask &
MAY_BE_NULL)) {
7317 *forced_allow_null =
true;
7320 if (is_marked_nullable || force_allow_null) {
7333 ast->
attr = orig_ast_attr;
7340 bool forced_allow_null;
7341 return zend_compile_typename_ex(ast,
false, &forced_allow_null);
7359static void zend_compile_attributes(
7370 for (g = 0; g < list->
children; g++) {
7375 for (i = 0; i < group->
children; i++) {
7383 "Cannot create Closure as attribute argument");
7391 zend_string_release(
lcname);
7396 zend_string_release(
name);
7405 zend_string_release(
name);
7411 bool uses_named_args = 0;
7412 for (
j = 0;
j <
args->children;
j++) {
7418 "Cannot use unpacking in attribute argument list");
7422 attr->args[
j].name = zend_string_copy(zend_ast_get_str(arg_ast->
child[0]));
7423 arg_ast_ptr = &arg_ast->
child[1];
7424 uses_named_args = 1;
7426 for (uint32_t k = 0; k <
j; k++) {
7427 if (
attr->args[k].name &&
7428 zend_string_equals(
attr->args[k].name,
attr->args[
j].name)) {
7433 }
else if (uses_named_args) {
7435 "Cannot use positional argument after named argument");
7439 &
attr->args[
j].value, arg_ast_ptr,
true);
7445 if (*attributes !=
NULL) {
7475static void zend_compile_property_hooks(
7484static void zend_property_hook_find_property_usage(
zend_ast **ast_ptr,
void *_context)
7498 zval *
object = zend_ast_get_zval(object_ast->
child[0]);
7499 zval *
property = zend_ast_get_zval(property_ast);
7504 context->uses_property =
true;
7512 if (!zend_ast_is_special(ast)) {
7525 zend_property_hook_find_property_usage(&hook_ast, &
context);
7538 bool is_virtual =
true;
7541 for (uint32_t i = 0; i < hooks->
children; i++) {
7544 if (
body && zend_property_hook_uses_property(property_name, hook->name,
body)) {
7552static void zend_compile_params(
zend_ast *ast,
zend_ast *return_type_ast, uint32_t fallback_return_type)
7559 if (return_type_ast || fallback_return_type) {
7563 if (return_type_ast) {
7564 arg_infos->
type = zend_compile_typename(return_type_ast);
7587 uint32_t last_required_param = (uint32_t) -1;
7588 for (i = 0; i < list->
children; ++i) {
7592 if (!default_ast_ptr && !is_variadic) {
7593 last_required_param = i;
7597 for (i = 0; i < list->
children; ++i) {
7609 bool is_promoted = property_flags || hooks_ast;
7611 znode var_node, default_node;
7627 }
else if (zend_string_equals(
name,
ZSTR_KNOWN(ZEND_STR_THIS))) {
7640 if (*default_ast_ptr) {
7642 "Variadic parameter cannot have a default value");
7644 }
else if (*default_ast_ptr) {
7646 uint32_t cops =
CG(compiler_options);
7651 &default_node.
u.
constant, default_ast_ptr,
true);
7652 CG(compiler_options) = cops;
7659 arg_info = &arg_infos[i];
7660 arg_info->
name = zend_string_copy(
name);
7663 if (attributes_ast) {
7664 zend_compile_attributes(
7670 bool forced_allow_nullable =
false;
7673 bool force_nullable = default_type ==
IS_NULL && !is_promoted;
7676 arg_info->
type = zend_compile_typename_ex(type_ast, force_nullable, &forced_allow_nullable);
7677 if (forced_allow_nullable) {
7680 "%s(): Implicitly marking parameter $%s as nullable is deprecated, the explicit nullable type "
7694 && !zend_is_valid_default_value(arg_info->
type, &default_node.
u.
constant)) {
7697 "Cannot use %s as default value for parameter $%s of type %s",
7702 if (last_required_param != (uint32_t) -1
7703 && i < last_required_param
7707 if (!forced_allow_nullable) {
7709 zend_ast *required_param_ast = list->
child[last_required_param];
7711 "%s(): Optional parameter $%s declared before required parameter $%s "
7712 "is implicitly treated as a required parameter",
7725 opline = zend_emit_op(
NULL, opcode,
NULL, &default_node);
7732 zend_alloc_cache_slots(zend_type_get_num_classes(arg_info->
type));
7739 opline->
op2.
num = type_ast ?
7751 "Cannot declare promoted property outside a constructor");
7756 "Cannot declare promoted property in an abstract constructor");
7760 "Cannot declare variadic promoted property");
7762 if (zend_hash_exists(&
scope->properties_info,
name)) {
7769 "Property %s::$%s cannot have type %s",
7780 type = zend_compile_typename(type_ast);
7802 doc_comment_ast ? zend_string_copy(zend_ast_get_str(doc_comment_ast)) :
NULL;
7809 zend_compile_property_hooks(prop,
name, type_ast, hooks);
7811 if (attributes_ast) {
7812 zend_compile_attributes(
7828 for (i = 0; i < list->
children; i++) {
7833 bool is_promoted =
flags || hooks_ast;
7840 znode name_node, value_node;
7849 zend_emit_op_data(&value_node);
7867 for (i = 0; i < list->
children; ++i) {
7870 uint32_t
mode = var_name_ast->
attr;
7885 "Cannot use variable $%S twice",
var_name);
7888 CG(zend_lineno) = zend_ast_get_lineno(var_name_ast);
7926 find_implicit_binds_recursively(info, name_ast);
7928 }
else if (zend_ast_is_list(ast)) {
7931 for (i = 0; i < list->
children; i++) {
7932 find_implicit_binds_recursively(info, list->
child[i]);
7941 for (i = 0; i < uses_list->
children; i++) {
7948 find_implicit_binds_recursively(info, closure_ast->
child[2]);
7949 }
else if (!zend_ast_is_special(ast)) {
7950 uint32_t i, children = zend_ast_get_num_children(ast);
7951 for (i = 0; i < children; i++) {
7952 find_implicit_binds_recursively(info, ast->
child[i]);
7964 find_implicit_binds_recursively(info, stmt_ast);
7967 for (i = 0; i < param_list->
children; i++) {
7973static void compile_implicit_lexical_binds(
7980 if (zend_hash_num_elements(&info->
uses) == 0) {
8000static void zend_compile_closure_uses(
zend_ast *ast)
8006 for (i = 0; i < list->
children; ++i) {
8015 for (i = 0; i < op_array->
last_var; i++) {
8018 "Cannot use lexical variable $%S as a parameter name",
var_name);
8023 CG(zend_lineno) = zend_ast_get_lineno(var_ast);
8025 if (var_ast->
attr) {
8034static void zend_compile_implicit_closure_uses(
closure_info *info)
8066 uint32_t fn_flags = op_array->
fn_flags;
8106 }
else if (!has_body) {
8111 op_array->
scope = ce;
8125 add_stringable_interface(ce);
8132static uint32_t zend_add_dynamic_func_def(
zend_op_array *def) {
8155 if (
CG(active_op_array) &&
CG(active_op_array)->function_name) {
8160 function =
CG(active_op_array)->function_name;
8162 function =
CG(active_op_array)->function_name;
8165 if (
CG(active_class_entry) &&
CG(active_class_entry)->
name) {
8166 class = CG(active_class_entry)->
name;
8167 separator =
ZSTR_KNOWN(ZEND_STR_PAAMAYIM_NEKUDOTAYIM);
8174 "{closure:%S%S%S%s:%" PRIu32
"}",
8184 unqualified_name = decl->
name;
8190 if (
FC(imports_function)) {
8201 "__autoload() is no longer supported, use spl_autoload_register() instead");
8206 "Defining a custom assert() function is not allowed, "
8207 "as the function has special semantics");
8212 uint32_t func_ref = zend_add_dynamic_func_def(op_array);
8215 opline->
op2.
num = func_ref;
8217 opline = get_next_op();
8221 opline->
op2.
num = func_ref;
8269 op_array->
scope = ce;
8271 }
else if (is_method) {
8272 bool has_body = stmt_ast !=
NULL;
8273 lcname = zend_begin_method_decl(op_array, decl->
name, has_body);
8275 lcname = zend_begin_func_decl(
result, op_array, decl, toplevel);
8277 find_implicit_binds(&info, params_ast, stmt_ast);
8278 compile_implicit_lexical_binds(&info,
result, op_array);
8279 }
else if (uses_ast) {
8280 zend_compile_closure_binding(
result, op_array, uses_ast);
8284 CG(active_op_array) = op_array;
8286 if (decl->
child[4]) {
8289 if (is_method || is_hook) {
8293 zend_compile_attributes(&op_array->
attributes, decl->
child[4], 0, target, 0);
8298 sizeof(
"override")-1
8301 if (override_attribute) {
8308 sizeof(
"deprecated")-1
8311 if (deprecated_attribute) {
8320 CG(active_class_entry) =
NULL;
8328 CG(
context).active_property_info = property_info;
8329 CG(
context).active_property_hook_kind = hook_kind;
8339 zend_compile_params(params_ast, return_type_ast,
8342 zend_mark_function_as_generator();
8346 zend_compile_implicit_closure_uses(&info);
8348 }
else if (uses_ast) {
8349 zend_compile_closure_uses(uses_ast);
8353 bool needs_return =
true;
8360 decl->
child[2] = stmt_ast;
8364 zend_compile_stmt(stmt_ast);
8370 }
else if (toplevel) {
8374 do_bind_function_error(
lcname, op_array,
true);
8381 zend_do_extended_stmt();
8391 zend_observer_function_declared_notify(op_array,
lcname);
8398 CG(active_op_array) = orig_op_array;
8399 CG(active_class_entry) = orig_class_entry;
8419static void zend_compile_property_hooks(
8433 for (uint32_t i = 0; i < hooks->
children; i++) {
8439 CG(zend_lineno) = hook->start_lineno;
8444 hook->flags |= hook_visibility;
8461 "Property hook cannot be both abstract and private");
8466 }
else if (!stmt_ast) {
8473 "Unknown hook \"%s\" for property %s::$%s, expected \"get\" or \"set\"",
8478 stmt_ast = stmt_ast->
child[0];
8490 hook->child[2] = stmt_ast;
8494 if (hook->child[0]) {
8501 return_type_ast_ptr = &hook->
child[3];
8502 *return_type_ast_ptr = prop_type_ast;
8504 if (hook->child[0]) {
8505 zend_ast_list *param_list = zend_ast_get_list(hook->child[0]);
8519 if (value_param_ast->
child[2]) {
8523 if ((prop_type_ast !=
NULL) != (value_param_ast->
child[0] !=
NULL)) {
8532 value_type_ast_ptr = ¶m->
child[0];
8537 hook->child[3] = return_type;
8556 "Cannot redeclare property hook \"%s\"",
ZSTR_VAL(
name));
8574 zend_string_release(
name);
8576 if (return_type_ast_ptr) {
8577 *return_type_ast_ptr =
NULL;
8579 if (value_type_ast_ptr) {
8580 *value_type_ast_ptr =
NULL;
8587#ifndef ZEND_OPCACHE_SHM_REATTACHMENT
8603 uint32_t i, children = list->
children;
8626 "Property in interface cannot be explicitly abstract. "
8627 "All interface members are implicitly abstract");
8632 for (i = 0; i < children; ++i) {
8650 CG(
context).active_property_info = &dummy_prop_info;
8655 "Interfaces may only include hooked properties");
8659 "Only hooked properties may be declared abstract");
8667 type = zend_compile_typename(type_ast);
8672 "Property %s::$%s cannot have type %s",
8678 if (doc_comment_ast) {
8679 doc_comment = zend_string_copy(zend_ast_get_str(doc_comment_ast));
8687 if (*value_ast_ptr) {
8691 && !zend_is_valid_default_value(
type, &value_zv)) {
8698 "Default value for property of type %s may not be null. "
8699 "Use the nullable type %s to allow null default value",
8703 "Cannot use %s as default value for property %s::$%s of type %s",
8725 "Readonly property %s::$%s cannot have default value",
8730 "Static property %s::$%s cannot be readonly",
8738 zend_compile_property_hooks(info,
name, type_ast, zend_ast_get_list(hooks_ast));
8745 CG(
context).active_property_info = old_active_property_info;
8750static void zend_compile_prop_group(
zend_ast *ast)
8756 zend_compile_prop_decl(prop_ast, type_ast, ast->
attr, attr_ast);
8760static void zend_check_trait_alias_modifiers(uint32_t
attr)
8774 uint32_t i, children = list->
children;
8776 for (i = 0; i < children; ++i) {
8783 zend_string *doc_comment = doc_comment_ast ? zend_string_copy(zend_ast_get_str(doc_comment_ast)) :
NULL;
8788 type = zend_compile_typename(type_ast);
8802 E_COMPILE_ERROR,
"Private constant %s::%s cannot be final as it is not visible to other classes",
8830static void zend_compile_class_const_group(
zend_ast *ast)
8836 zend_compile_class_const_decl(const_ast, ast->
attr, attr_ast, type_ast);
8845 method_ref->
method_name = zend_string_copy(zend_ast_get_str(method_ast));
8848 method_ref->
class_name = zend_resolve_const_class_name_reference(class_ast,
"trait name");
8855static void zend_compile_trait_precedence(
zend_ast *ast)
8859 zend_ast_list *insteadof_list = zend_ast_get_list(insteadof_ast);
8863 zend_compile_method_ref(method_ref_ast, &precedence->
trait_method);
8866 for (i = 0; i < insteadof_list->
children; ++i) {
8869 zend_resolve_const_class_name_reference(name_ast,
"trait name");
8872 zend_add_to_list(&
CG(active_class_entry)->trait_precedences, precedence);
8876static void zend_compile_trait_alias(
zend_ast *ast)
8880 uint32_t modifiers = ast->
attr;
8884 zend_check_trait_alias_modifiers(modifiers);
8887 zend_compile_method_ref(method_ref_ast, &alias->
trait_method);
8891 alias->
alias = zend_string_copy(zend_ast_get_str(alias_ast));
8896 zend_add_to_list(&
CG(active_class_entry)->trait_aliases, alias);
8900static void zend_compile_use_trait(
zend_ast *ast)
8909 for (i = 0; i < traits->
children; ++i) {
8919 zend_resolve_const_class_name_reference(trait_ast,
"trait name");
8928 for (i = 0; i < adaptations->
children; ++i) {
8930 switch (adaptation_ast->
kind) {
8932 zend_compile_trait_precedence(adaptation_ast);
8935 zend_compile_trait_alias(adaptation_ast);
8943static void zend_compile_implements(
zend_ast *ast)
8952 for (i = 0; i < list->
children; ++i) {
8954 interface_names[i].
name =
8955 zend_resolve_const_class_name_reference(class_ast,
"interface name");
8956 interface_names[i].
lc_name = zend_string_tolower(interface_names[i].
name);
8971 if (decl->
child[0]) {
8972 prefix = zend_resolve_const_class_name_reference(decl->
child[0],
"class name");
8973 }
else if (decl->
child[1]) {
8975 prefix = zend_resolve_const_class_name_reference(list->
child[0],
"interface name");
8980 zend_string_release(
prefix);
8987 zend_type type = zend_compile_typename(enum_backing_type_ast);
8992 "Enum backing type must be int or string, %s given",
9020 if (
CG(active_class_entry)) {
9024 const char *
type =
"a class name";
9026 type =
"an enum name";
9028 type =
"an interface name";
9030 type =
"a trait name";
9033 name = zend_prefix_with_ns(unqualified_name);
9042 "(previously declared as local import)",
ZSTR_VAL(
name));
9052 zend_tmp_string_release(
name);
9053 zend_tmp_string_release(
lcname);
9054 name = zend_generate_anon_class_name(decl);
9056 }
while (zend_hash_exists(
CG(class_table),
lcname));
9089 zend_resolve_const_class_name_reference(extends_ast,
"class name");
9092 CG(active_class_entry) = ce;
9094 if (decl->
child[3]) {
9098 if (implements_ast) {
9099 zend_compile_implements(implements_ast);
9103 if (enum_backing_type_ast !=
NULL) {
9104 zend_compile_enum_backing_type(ce, enum_backing_type_ast);
9110 zend_compile_stmt(stmt_ast);
9119 CG(active_class_entry) = original_ce;
9127#ifdef ZEND_OPCACHE_SHM_REATTACHMENT
9140 zend_string_release(
lcname);
9145 zend_string_release(
lcname);
9149 zend_observer_class_linked_notify(ce,
lcname);
9154 }
else if (!extends_ast) {
9163 opline = get_next_op();
9184 zend_make_var_result(
result, opline);
9185 if (!zend_hash_add_ptr(
CG(class_table),
lcname, ce)) {
9188 "Runtime definition key collision for %s. This is a bug",
ZSTR_VAL(
name));
9194 zend_tmp_string_release(
key);
9196 }
while (!zend_hash_add_ptr(
CG(class_table),
key, ce));
9199 zend_add_literal_string(&
key);
9223static void zend_compile_enum_case(
zend_ast *ast)
9233 zval class_name_zval;
9237 zval case_name_zval;
9262 if (doc_comment_ast) {
9263 doc_comment = zend_string_copy(zend_ast_get_str(doc_comment_ast));
9292 if (!
FC(imports_function)) {
9296 return FC(imports_function);
9298 if (!
FC(imports_const)) {
9302 return FC(imports_const);
9310static char *zend_get_use_type_str(uint32_t
type)
9337static void zend_compile_use(
zend_ast *ast)
9346 for (i = 0; i < list->
children; ++i) {
9350 zend_string *old_name = zend_ast_get_str(old_name_ast);
9354 new_name = zend_string_copy(zend_ast_get_str(new_name_ast));
9356 const char *unqualified_name;
9357 size_t unqualified_name_len;
9358 if (zend_get_unqualified_name(old_name, &unqualified_name, &unqualified_name_len)) {
9360 new_name = zend_string_init(unqualified_name, unqualified_name_len, 0);
9362 new_name = zend_string_copy(old_name);
9366 "has no effect",
ZSTR_VAL(new_name));
9371 if (case_sensitive) {
9372 lookup_name = zend_string_copy(new_name);
9374 lookup_name = zend_string_tolower(new_name);
9388 if (zend_have_seen_symbol(ns_name,
type)) {
9389 zend_check_already_in_use(
type, old_name, new_name, ns_name);
9392 zend_string_efree(ns_name);
9393 }
else if (zend_have_seen_symbol(lookup_name,
type)) {
9394 zend_check_already_in_use(
type, old_name, new_name, lookup_name);
9397 zend_string_addref(old_name);
9399 if (!zend_hash_add_ptr(current_import, lookup_name, old_name)) {
9410static void zend_compile_group_use(
zend_ast *ast)
9416 for (i = 0; i < list->
children; i++) {
9418 zval *name_zval = zend_ast_get_zval(use->
child[0]);
9425 zend_compile_use(inline_use);
9430static void zend_compile_const_decl(
zend_ast *ast)
9434 for (i = 0; i < list->
children; ++i) {
9438 zend_string *unqualified_name = zend_ast_get_str(name_ast);
9441 znode name_node, value_node;
9447 if (zend_get_special_const(
ZSTR_VAL(unqualified_name),
ZSTR_LEN(unqualified_name))) {
9449 "Cannot redeclare constant '%s'",
ZSTR_VAL(unqualified_name));
9452 name = zend_prefix_with_ns(unqualified_name);
9455 if (
FC(imports_const)) {
9456 zend_string *import_name = zend_hash_find_ptr(
FC(imports_const), unqualified_name);
9457 if (import_name && !zend_string_equals(import_name,
name)) {
9473static void zend_compile_namespace(
zend_ast *ast)
9478 bool with_bracket = stmt_ast !=
NULL;
9481 if (!
FC(has_bracketed_namespaces)) {
9482 if (
FC(current_namespace)) {
9486 "with unbracketed namespace declarations");
9491 if (!with_bracket) {
9493 "with unbracketed namespace declarations");
9494 }
else if (
FC(current_namespace) ||
FC(in_namespace)) {
9499 bool is_first_namespace = (!with_bracket && !
FC(current_namespace))
9500 || (with_bracket && !
FC(has_bracketed_namespaces));
9501 if (is_first_namespace &&
FAILURE == zend_is_first_statement(ast, 1)) {
9503 "the very first statement or after any declare call in the script");
9506 if (
FC(current_namespace)) {
9511 name = zend_ast_get_str(name_ast);
9517 FC(current_namespace) = zend_string_copy(
name);
9519 FC(current_namespace) =
NULL;
9522 zend_reset_import_tables();
9524 FC(in_namespace) = 1;
9526 FC(has_bracketed_namespaces) = 1;
9531 zend_end_namespace();
9536static void zend_compile_halt_compiler(
zend_ast *ast)
9542 const char const_name[] =
"__COMPILER_HALT_OFFSET__";
9544 if (
FC(has_bracketed_namespaces) &&
FC(in_namespace)) {
9546 "__HALT_COMPILER() can only be used from the outermost scope");
9563 switch (ast->
attr) {
9584#elif defined(HAVE_GETWD)
9616 if (op_array->
scope) {
9645 if (
FC(current_namespace)) {
9665 && !zend_is_long_compatible(
Z_DVAL_P(op), zend_dval_to_lval(
Z_DVAL_P(op)))) {
9672 if (is_num == 0 || (is_num ==
IS_DOUBLE && !zend_is_long_compatible(
dval, zend_dval_to_lval(
dval)))) {
9721 if ((opcode ==
ZEND_MOD && zval_get_long(
op2) == 0)
9722 || (opcode ==
ZEND_DIV && zval_get_double(
op2) == 0.0)) {
9726 if ((opcode ==
ZEND_POW) && zval_get_double(
op1) == 0 && zval_get_double(
op2) < 0) {
9770static inline bool zend_try_ct_eval_unary_op(
zval *
result, uint32_t opcode,
zval *op)
9803 bool is_constant = 1;
9810 for (i = 0; i < list->
children; ++i) {
9813 if (elem_ast ==
NULL) {
9815 if (last_elem_ast) {
9816 CG(zend_lineno) = zend_ast_get_lineno(last_elem_ast);
9822 zend_eval_const_expr(&elem_ast->
child[0]);
9823 zend_eval_const_expr(&elem_ast->
child[1]);
9831 zend_eval_const_expr(&elem_ast->
child[0]);
9838 last_elem_ast = elem_ast;
9851 for (i = 0; i < list->
children; ++i) {
9856 zval *
value = zend_ast_get_zval(value_ast);
9881 key_ast = elem_ast->
child[1];
9883 zval *
key = zend_ast_get_zval(key_ast);
9894 if (!zend_is_long_compatible(
Z_DVAL_P(
key), lval)) {
9895 zval_ptr_dtor_nogc(
value);
9916 zval_ptr_dtor_nogc(
value);
9930 uint32_t opcode = ast->
attr;
9932 znode left_node, right_node;
9934 zend_compile_expr(&left_node, left_ast);
9935 zend_compile_expr(&right_node, right_ast);
9938 if (zend_try_ct_eval_binary_op(&
result->u.constant, opcode,
9953 zend_emit_op_tmp(
result, opcode, &right_node,
NULL);
9957 zend_emit_op_tmp(
result, opcode, &right_node,
NULL);
9963 zend_emit_op_tmp(
result, opcode, &left_node,
NULL);
9967 zend_emit_op_tmp(
result, opcode, &left_node,
NULL);
10012 zend_emit_op_tmp(
result, opcode, &left_node, &right_node);
10023 znode left_node, right_node;
10027 zend_compile_expr(&left_node, left_ast);
10028 zend_compile_expr(&right_node, right_ast);
10032 zend_ct_eval_greater(&
result->u.constant, ast->
kind,
10039 zend_emit_op_tmp(
result,
10041 &right_node, &left_node);
10048 uint32_t opcode = ast->
attr;
10051 zend_compile_expr(&expr_node, expr_ast);
10054 && zend_try_ct_eval_unary_op(&
result->u.constant, opcode, &expr_node.
u.
constant)) {
10060 zend_emit_op_tmp(
result, opcode, &expr_node,
NULL);
10067 znode expr_node, right_node;
10071 zend_compile_expr(&expr_node, expr_ast);
10091 znode left_node, right_node;
10092 zend_op *opline_jmpz, *opline_bool;
10093 uint32_t opnum_jmpz;
10097 zend_compile_expr(&left_node, left_ast);
10105 zend_compile_expr(&right_node, right_ast);
10121 opnum_jmpz = get_next_op_number();
10129 zend_make_tmp_result(
result, opline_jmpz);
10132 zend_compile_expr(&right_node, right_ast);
10137 zend_update_jump_target_to_next(opnum_jmpz);
10146 zend_ensure_writable_variable(var_ast);
10151 zend_make_tmp_result(
result, opline);
10155 zend_make_tmp_result(
result, opline);
10173 zend_ensure_writable_variable(var_ast);
10203 zend_compile_expr(&expr_node, expr_ast);
10221 znode cond_node, false_node;
10223 uint32_t opnum_jmp_set;
10227 zend_compile_expr(&cond_node, cond_ast);
10229 opnum_jmp_set = get_next_op_number();
10232 zend_compile_expr(&false_node, false_ast);
10237 zend_update_jump_target_to_next(opnum_jmp_set);
10247 znode cond_node, true_node, false_node;
10249 uint32_t opnum_jmpz, opnum_jmp;
10253 if (cond_ast->
child[1]) {
10256 "Unparenthesized `a ? b : c ? d : e` is not supported. "
10257 "Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`");
10260 "Unparenthesized `a ? b : c ?: d` is not supported. "
10261 "Use either `(a ? b : c) ?: d` or `a ? b : (c ?: d)`");
10266 "Unparenthesized `a ?: b ? c : d` is not supported. "
10267 "Use either `(a ?: b) ? c : d` or `a ?: (b ? c : d)`");
10276 zend_compile_shorthand_conditional(
result, ast);
10280 zend_compile_expr(&cond_node, cond_ast);
10282 opnum_jmpz = zend_emit_cond_jump(
ZEND_JMPZ, &cond_node, 0);
10284 zend_compile_expr(&true_node, true_ast);
10288 opnum_jmp = zend_emit_jump(0);
10290 zend_update_jump_target_to_next(opnum_jmpz);
10292 zend_compile_expr(&false_node, false_ast);
10297 zend_update_jump_target_to_next(opnum_jmp);
10306 znode expr_node, default_node;
10310 zend_compile_var(&expr_node, expr_ast,
BP_VAR_IS, 0);
10312 opnum = get_next_op_number();
10315 zend_compile_expr(&default_node, default_ast);
10320 opline = &
CG(active_op_array)->opcodes[opnum];
10325static void znode_dtor(
zval *
zv) {
10338 znode var_node_is, var_node_w, default_node, assign_node, *node;
10340 uint32_t coalesce_opnum;
10341 bool need_frees = 0;
10345 HashTable *orig_memoized_exprs =
CG(memoized_exprs);
10348 zend_ensure_writable_variable(var_ast);
10349 if (is_this_fetch(var_ast)) {
10357 zend_compile_var(&var_node_is, var_ast,
BP_VAR_IS, 0);
10359 coalesce_opnum = get_next_op_number();
10364 zend_compile_expr_with_potential_assign_to_self(&default_node, default_ast, var_ast);
10366 zend_compile_expr(&default_node, default_ast);
10370 zend_compile_var(&var_node_w, var_ast,
BP_VAR_W, 0);
10373 opline = &
CG(active_op_array)->opcodes[
CG(active_op_array)->last-1];
10378 zend_emit_op_tmp(&assign_node,
ZEND_ASSIGN, &var_node_w, &default_node);
10384 zend_emit_op_data(&default_node);
10385 assign_node = var_node_w;
10391 zend_emit_op_data(&default_node);
10392 assign_node = var_node_w;
10399 zend_emit_op_data(&default_node);
10400 assign_node = var_node_w;
10417 uint32_t jump_opnum = zend_emit_jump(0);
10418 zend_update_jump_target_to_next(coalesce_opnum);
10424 zend_update_jump_target_to_next(jump_opnum);
10426 zend_update_jump_target_to_next(coalesce_opnum);
10431 CG(memoized_exprs) = orig_memoized_exprs;
10432 CG(memoize_mode) = orig_memoize_mode;
10442 zend_compile_expr(&expr_node, expr_ast);
10457 znode value_node, key_node;
10462 zend_mark_function_as_generator();
10465 zend_compile_expr(&key_node, key_ast);
10466 key_node_ptr = &key_node;
10470 if (returns_by_ref && zend_is_variable(value_ast)) {
10471 zend_assert_not_short_circuited(value_ast);
10472 zend_compile_var(&value_node, value_ast,
BP_VAR_W, 1);
10474 zend_compile_expr(&value_node, value_ast);
10476 value_node_ptr = &value_node;
10481 if (value_ast && returns_by_ref && zend_is_call(value_ast)) {
10492 zend_mark_function_as_generator();
10496 "Cannot use \"yield from\" inside a by-reference generator");
10499 zend_compile_expr(&expr_node, expr_ast);
10509 znode obj_node, class_node;
10512 zend_compile_expr(&obj_node, obj_ast);
10514 zend_do_free(&obj_node);
10520 zend_compile_class_ref(&class_node, class_ast,
10527 opline->
op2.
constant = zend_add_class_name_literal(
10542 zend_do_extended_fcall_begin();
10543 zend_compile_expr(&expr_node, expr_ast);
10548 zend_do_extended_fcall_end();
10561 if (!zend_is_variable(var_ast)) {
10565 zend_compile_expr(
result, not_ast);
10569 "Cannot use isset() on the result of an expression "
10570 "(you can use \"null !== expression\" instead)");
10574 if (is_globals_fetch(var_ast)) {
10580 if (is_global_var_fetch(var_ast)) {
10581 if (!var_ast->
child[1]) {
10585 zend_compile_expr(&var_node, var_ast->
child[1]);
10596 zend_short_circuiting_mark_inner(var_ast);
10597 switch (var_ast->
kind) {
10599 if (is_this_fetch(var_ast)) {
10602 }
else if (zend_try_compile_cv(&var_node, var_ast) ==
SUCCESS) {
10605 opline = zend_compile_simple_var_no_cv(
result, var_ast,
BP_VAR_IS, 0);
10635 znode silence_node;
10644 zend_compile_expr(
result, expr_ast);
10656 zend_ast *name_ast, *args_ast, *call_ast;
10663 zend_compile_expr(
result, call_ast);
10673 uint32_t i, opnum_init = -1;
10676 if (zend_try_ct_eval_array(&
result->u.constant, ast)) {
10684 for (i = 0; i < list->
children; ++i) {
10688 znode value_node, key_node, *key_node_ptr =
NULL;
10690 if (elem_ast ==
NULL) {
10694 value_ast = elem_ast->
child[0];
10697 zend_compile_expr(&value_node, value_ast);
10699 opnum_init = get_next_op_number();
10707 key_ast = elem_ast->
child[1];
10708 by_ref = elem_ast->
attr;
10711 zend_compile_expr(&key_node, key_ast);
10712 zend_handle_numeric_op(&key_node);
10713 key_node_ptr = &key_node;
10717 zend_ensure_writable_variable(value_ast);
10718 zend_compile_var(&value_node, value_ast,
BP_VAR_W, 1);
10720 zend_compile_expr(&value_node, value_ast);
10724 opnum_init = get_next_op_number();
10729 &value_node, key_node_ptr);
10742 opline = &
CG(active_op_array)->opcodes[opnum_init];
10754 bool is_fully_qualified;
10755 zend_string *orig_name = zend_ast_get_str(name_ast);
10756 zend_string *resolved_name = zend_resolve_const_name(orig_name, name_ast->
attr, &is_fully_qualified);
10776 if (zend_try_ct_eval_const(&
result->u.constant, resolved_name, is_fully_qualified)) {
10785 if (is_fully_qualified || !
FC(current_namespace)) {
10787 opline->
op2.
constant = zend_add_const_name_literal(
10791 opline->
op2.
constant = zend_add_const_name_literal(
10802 znode class_node, const_node;
10805 zend_eval_const_expr(&ast->
child[0]);
10806 zend_eval_const_expr(&ast->
child[1]);
10808 class_ast = ast->
child[0];
10809 const_ast = ast->
child[1];
10812 zval *const_zv = zend_ast_get_zval(const_ast);
10815 zend_string *resolved_name = zend_resolve_class_name_ast(class_ast);
10816 if (zend_try_ct_eval_class_const(&
result->u.constant, resolved_name, const_str)) {
10827 zend_compile_expr(&const_node, const_ast);
10831 zend_set_class_name_op1(opline, &class_node);
10843 if (zend_try_compile_const_expr_resolve_class_name(&
result->u.constant, class_ast)) {
10853 zend_compile_expr(&expr_node, class_ast);
10885 zend_op *opline = get_next_op();
10904 if (rope_elements == 1) {
10914 opline->
op1 = opline->
op2;
10916 zend_make_tmp_result(
result, opline);
10918 }
else if (rope_elements == 2) {
10922 opline->
op1 = init_opline->
op2;
10923 zend_make_tmp_result(
result, opline);
10930 zend_make_tmp_result(
result, opline);
10931 var = opline->
op1.
var = get_temporary_variable();
10934 uint32_t i = ((rope_elements *
sizeof(
zend_string*)) + (
sizeof(
zval) - 1)) /
sizeof(
zval);
10936 get_temporary_variable();
10941 while (opline != init_opline) {
10958 uint32_t rope_init_lineno = -1;
10960 znode elem_node, last_const_node;
10962 uint32_t reserved_op_number = -1;
10968 for (i = 0; i < list->
children; i++) {
10975 zend_error(
E_DEPRECATED,
"Using ${expr} (variable variables) in strings is deprecated, use {${expr}} instead");
10979 zend_compile_expr(&elem_node, encaps_var);
10993 reserved_op_number = get_next_op_number();
10994 opline = get_next_op();
11001 rope_init_lineno = reserved_op_number;
11003 rope_init_lineno = get_next_op_number();
11007 opline = &
CG(active_op_array)->opcodes[reserved_op_number];
11008 zend_compile_rope_add_ex(opline,
result,
j++, &last_const_node);
11011 opline = zend_compile_rope_add(
result,
j++, &elem_node);
11023 CG(active_op_array)->last = reserved_op_number - 1;
11026 opline = &
CG(active_op_array)->opcodes[reserved_op_number];
11027 opline = zend_compile_rope_add_ex(opline,
result,
j++, &last_const_node);
11029 init_opline =
CG(active_op_array)->opcodes + rope_init_lineno;
11030 zend_compile_rope_finalize(
result,
j, init_opline, opline);
11038 if (zend_try_ct_eval_magic_const(&
result->u.constant, ast)) {
11044 CG(active_class_entry) &&
11072static void zend_compile_const_expr_class_const(
zend_ast **ast_ptr)
11081 "Dynamic class names are not allowed in compile-time class constant references");
11087 class_name = zend_ast_get_str(class_ast);
11092 "\"static::\" is not allowed in compile-time constants");
11096 zend_string *tmp = zend_resolve_class_name_ast(class_ast);
11099 if (tmp != class_name) {
11100 zval *
zv = zend_ast_get_zval(class_ast);
11110static void zend_compile_const_expr_class_name(
zend_ast **ast_ptr)
11116 "(expression)::class cannot be used in constant expressions");
11119 zend_string *class_name = zend_ast_get_str(class_ast);
11122 switch (fetch_type) {
11126 zend_string_release(class_name);
11128 ast->
attr = fetch_type;
11132 "static::class cannot be used for compile-time class name resolution");
11138static void zend_compile_const_expr_const(
zend_ast **ast_ptr)
11142 zend_string *orig_name = zend_ast_get_str(name_ast);
11143 bool is_fully_qualified;
11147 CG(zend_lineno) = zend_ast_get_lineno(ast);
11149 resolved_name = zend_resolve_const_name(
11150 orig_name, name_ast->
attr, &is_fully_qualified);
11152 if (zend_try_ct_eval_const(&
result, resolved_name, is_fully_qualified)) {
11165static void zend_compile_const_expr_magic_const(
zend_ast **ast_ptr)
11177static void zend_compile_const_expr_new(
zend_ast **ast_ptr)
11182 "Cannot use anonymous class in constant expression");
11186 "Cannot use dynamic class name in constant expression");
11189 zend_string *class_name = zend_resolve_class_name_ast(class_ast);
11193 "\"static\" is not allowed in compile-time constants");
11196 zval *class_ast_zv = zend_ast_get_zval(class_ast);
11197 zval_ptr_dtor_nogc(class_ast_zv);
11198 ZVAL_STR(class_ast_zv, class_name);
11202static void zend_compile_const_expr_args(
zend_ast **ast_ptr)
11205 bool uses_named_args =
false;
11206 for (uint32_t i = 0; i < list->
children; i++) {
11210 "Argument unpacking in constant expressions is not supported");
11213 uses_named_args =
true;
11214 }
else if (uses_named_args) {
11216 "Cannot use positional argument after named argument");
11219 if (uses_named_args) {
11229static void zend_compile_const_expr(
zend_ast **ast_ptr,
void *
context)
11237 if (!zend_is_allowed_in_const_expr(ast->
kind)) {
11241 switch (ast->
kind) {
11243 zend_compile_const_expr_class_const(ast_ptr);
11246 zend_compile_const_expr_class_name(ast_ptr);
11249 zend_compile_const_expr_const(ast_ptr);
11252 zend_compile_const_expr_magic_const(ast_ptr);
11257 "New expressions are not supported in this context");
11259 zend_compile_const_expr_new(ast_ptr);
11262 zend_compile_const_expr_args(ast_ptr);
11273 context.allow_dynamic = allow_dynamic;
11275 zend_eval_const_expr(ast_ptr);
11276 zend_compile_const_expr(ast_ptr, &
context);
11298 for (i = 0; i < list->
children; ++i) {
11306 zend_compile_func_decl(
NULL, ast, 1);
11310 zend_compile_class_decl(
NULL, ast, 1);
11313 zend_compile_stmt(ast);
11316 zend_verify_namespace();
11321static void zend_compile_stmt(
zend_ast *ast)
11330 zend_do_extended_stmt();
11333 switch (ast->
kind) {
11335 zend_compile_stmt_list(ast);
11338 zend_compile_global_var(ast);
11341 zend_compile_static_var(ast);
11344 zend_compile_unset(ast);
11347 zend_compile_return(ast);
11350 zend_compile_echo(ast);
11354 zend_compile_break_continue(ast);
11357 zend_compile_goto(ast);
11360 zend_compile_label(ast);
11363 zend_compile_while(ast);
11366 zend_compile_do_while(ast);
11369 zend_compile_for(ast);
11372 zend_compile_foreach(ast);
11375 zend_compile_if(ast);
11378 zend_compile_switch(ast);
11381 zend_compile_try(ast);
11384 zend_compile_declare(ast);
11388 zend_compile_func_decl(
NULL, ast, 0);
11391 zend_compile_enum_case(ast);
11394 zend_compile_prop_group(ast);
11397 zend_compile_class_const_group(ast);
11400 zend_compile_use_trait(ast);
11403 zend_compile_class_decl(
NULL, ast, 0);
11406 zend_compile_group_use(ast);
11409 zend_compile_use(ast);
11412 zend_compile_const_decl(ast);
11415 zend_compile_namespace(ast);
11418 zend_compile_halt_compiler(ast);
11421 zend_compile_expr(
NULL, ast);
11426 zend_compile_expr(&
result, ast);
11431 if (
FC(declarables).ticks && !zend_is_unticked_stmt(ast)) {
11440 CG(zend_lineno) = zend_ast_get_lineno(ast);
11443 zend_compile_memoized_expr(
result, ast);
11447 switch (ast->
kind) {
11453 *
result = *zend_ast_get_znode(ast);
11468 zend_compile_assign(
result, ast);
11471 zend_compile_assign_ref(
result, ast);
11474 zend_compile_new(
result, ast);
11477 zend_compile_clone(
result, ast);
11480 zend_compile_compound_assign(
result, ast);
11483 zend_compile_binary_op(
result, ast);
11487 zend_compile_greater(
result, ast);
11490 zend_compile_unary_op(
result, ast);
11494 zend_compile_unary_pm(
result, ast);
11498 zend_compile_short_circuiting(
result, ast);
11502 zend_compile_post_incdec(
result, ast);
11506 zend_compile_pre_incdec(
result, ast);
11509 zend_compile_cast(
result, ast);
11512 zend_compile_conditional(
result, ast);
11515 zend_compile_coalesce(
result, ast);
11518 zend_compile_assign_coalesce(
result, ast);
11521 zend_compile_print(
result, ast);
11524 zend_compile_yield(
result, ast);
11527 zend_compile_yield_from(
result, ast);
11530 zend_compile_instanceof(
result, ast);
11533 zend_compile_include_or_eval(
result, ast);
11537 zend_compile_isset_or_empty(
result, ast);
11540 zend_compile_silence(
result, ast);
11543 zend_compile_shell_exec(
result, ast);
11546 zend_compile_array(
result, ast);
11549 zend_compile_const(
result, ast);
11552 zend_compile_class_const(
result, ast);
11555 zend_compile_class_name(
result, ast);
11558 zend_compile_encaps_list(
result, ast);
11561 zend_compile_magic_const(
result, ast);
11565 zend_compile_func_decl(
result, ast, 0);
11568 zend_compile_throw(
result, ast);
11571 zend_compile_match(
result, ast);
11581 zend_check_stack_limit();
11583 uint32_t checkpoint = zend_short_circuiting_checkpoint();
11584 zend_compile_expr_inner(
result, ast);
11585 zend_short_circuiting_commit(checkpoint,
result, ast);
11590 CG(zend_lineno) = zend_ast_get_lineno(ast);
11593 switch (ast->
kind) {
11598 zend_compile_memoized_expr(
result, ast);
11604 switch (ast->
kind) {
11606 return zend_compile_simple_var(
result, ast,
type, 0);
11608 return zend_compile_dim(
result, ast,
type, by_ref);
11611 return zend_compile_prop(
result, ast,
type, by_ref);
11613 return zend_compile_static_prop(
result, ast,
type, by_ref, 0);
11618 zend_compile_parent_property_hook_call(
result, ast,
type);
11622 zend_compile_method_call(
result, ast,
type);
11625 zend_compile_static_call(
result, ast,
type);
11628 *
result = *zend_ast_get_znode(ast);
11633 "Cannot use temporary expression in write context");
11636 zend_compile_expr(
result, ast);
11643 zend_check_stack_limit();
11645 uint32_t checkpoint = zend_short_circuiting_checkpoint();
11647 zend_short_circuiting_commit(checkpoint,
result, ast);
11653 zend_check_stack_limit();
11655 switch (ast->
kind) {
11657 return zend_compile_simple_var(
result, ast,
type, 1);
11659 return zend_delayed_compile_dim(
result, ast,
type, by_ref);
11670 return zend_compile_static_prop(
result, ast,
type, by_ref, 1);
11672 return zend_compile_var(
result, ast,
type, 0);
11677static void zend_eval_const_expr(
zend_ast **ast_ptr)
11686 zend_check_stack_limit();
11688 switch (ast->
kind) {
11690 zend_eval_const_expr(&ast->
child[0]);
11691 zend_eval_const_expr(&ast->
child[1]);
11696 if (!zend_try_ct_eval_binary_op(&
result, ast->
attr,
11697 zend_ast_get_zval(ast->
child[0]), zend_ast_get_zval(ast->
child[1]))
11704 zend_eval_const_expr(&ast->
child[0]);
11705 zend_eval_const_expr(&ast->
child[1]);
11711 zend_ast_get_zval(ast->
child[0]), zend_ast_get_zval(ast->
child[1]));
11716 bool child0_is_true, child1_is_true;
11717 zend_eval_const_expr(&ast->
child[0]);
11718 zend_eval_const_expr(&ast->
child[1]);
11742 zend_eval_const_expr(&ast->
child[0]);
11747 if (!zend_try_ct_eval_unary_op(&
result, ast->
attr, zend_ast_get_zval(ast->
child[0]))) {
11753 zend_eval_const_expr(&ast->
child[0]);
11758 if (!zend_try_ct_eval_unary_pm(&
result, ast->
kind, zend_ast_get_zval(ast->
child[0]))) {
11767 zend_eval_const_expr(&ast->
child[0]);
11771 zend_eval_const_expr(&ast->
child[1]);
11776 zend_eval_const_expr(&ast->
child[1]);
11777 *ast_ptr = ast->
child[1];
11781 *ast_ptr = ast->
child[0];
11789 zend_eval_const_expr(&ast->
child[0]);
11792 if (ast->
child[1]) {
11793 zend_eval_const_expr(&ast->
child[1]);
11795 zend_eval_const_expr(&ast->
child[2]);
11800 if (*child ==
NULL) {
11803 child_ast = *child;
11806 *ast_ptr = child_ast;
11807 zend_eval_const_expr(ast_ptr);
11824 zend_eval_const_expr(&ast->
child[0]);
11825 zend_eval_const_expr(&ast->
child[1]);
11831 dim = zend_ast_get_zval(ast->
child[1]);
11873 if (!zend_try_ct_eval_array(&
result, ast)) {
11878 if (!zend_try_ct_eval_magic_const(&
result, ast)) {
11885 bool is_fully_qualified;
11886 zend_string *resolved_name = zend_resolve_const_name(
11887 zend_ast_get_str(name_ast), name_ast->
attr, &is_fully_qualified);
11889 if (!zend_try_ct_eval_const(&
result, resolved_name, is_fully_qualified)) {
11903 zend_eval_const_expr(&ast->
child[0]);
11904 zend_eval_const_expr(&ast->
child[1]);
11911 class_ast = ast->
child[0];
11912 name_ast = ast->
child[1];
11918 resolved_name = zend_resolve_class_name_ast(class_ast);
11919 if (!zend_try_ct_eval_class_const(&
result, resolved_name, zend_ast_get_str(name_ast))) {
11930 if (!zend_try_compile_const_expr_resolve_class_name(&
result, class_ast)) {
11942 for (uint32_t i = 0; i < list->
children; i++) {
11943 zend_eval_const_expr(&list->
child[i]);
11948 zend_eval_const_expr(&ast->
child[0]);
11949 zend_eval_const_expr(&ast->
child[1]);
11952 zend_eval_const_expr(&ast->
child[1]);
11955 zend_eval_const_expr(&ast->
child[2]);
11959 zend_eval_const_expr(&ast->
child[0]);
11960 zend_eval_const_expr(&ast->
child[1]);
dirname(string $path, int $levels=1)
count(Countable|array $value, int $mode=COUNT_NORMAL)
memset(ptr, 0, type->size)
PW32IO size_t php_win32_ioutil_dirname(char *path, size_t len)
unsigned const char * end
unsigned char key[REFLECTION_KEY_LEN]
zend_string * doc_comment
zend_auto_global_callback auto_global_callback
HashTable constants_table
zend_function * __debugInfo
zend_object *(* create_object)(zend_class_entry *class_type)
zend_function * __tostring
zend_class_iterator_funcs * iterator_funcs_ptr
struct _zend_module_entry * module
zval * default_static_members_table
HashTable * backed_enum_table
struct _zend_class_entry::@126215362204241324314155352336150042254204116267::@166057154351252324007362117353350250255142166322 user
uint32_t num_hooked_props
HashTable properties_info
zend_trait_precedence ** trait_precedences
zend_object_iterator *(* get_iterator)(zend_class_entry *ce, zval *object, int by_ref)
zend_class_name * trait_names
zend_class_name * interface_names
zend_function * __unserialize
union _zend_class_entry::@126215362204241324314155352336150042254204116267 info
struct _zend_class_entry::@126215362204241324314155352336150042254204116267::@031207115026352130035014265255253014334154061307 internal
const struct _zend_function_entry * builtin_functions
zend_class_arrayaccess_funcs * arrayaccess_funcs_ptr
zend_string * parent_name
int default_properties_count
zend_function * __serialize
zend_trait_alias ** trait_aliases
zend_class_entry ** interfaces
zend_function *(* get_static_method)(zend_class_entry *ce, zend_string *method)
int default_static_members_count
zend_function * constructor
uint32_t enum_backing_type
uint32_t num_hooked_prop_variance_checks
struct _zend_property_info ** properties_info_table
zend_class_entry * parent
int(* serialize)(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data)
zend_string * doc_comment
zval * default_properties_table
int(* unserialize)(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data)
const zend_object_handlers * default_object_handlers
zend_function * __callstatic
zend_function * destructor
void(* validator)(zend_attribute *attr, uint32_t target, zend_class_entry *scope)
zend_internal_arg_info * arg_info
uint32_t try_catch_offset
HashTable * static_variables
zend_op_array ** dynamic_func_defs
zend_string * doc_comment
uint32_t required_num_args
zend_try_catch_element * try_catch_array
zend_string * function_name
uint32_t num_dynamic_func_defs
struct _zend_oparray_context * prev
zend_trait_method_reference trait_method
zend_string * method_name
zend_trait_method_reference trait_method
zend_string * exclude_class_names[1]
union _znode::@364205230302335155223131164306162132011251341067 u
const char * correct_name
zend_string * property_name
zend_string * function_name
struct _zend_function::@236135173067030250234125302313220025134003177336 common
zend_internal_function internal_function
ZEND_API zend_string * zend_strpprintf(size_t max_len, const char *format,...)
ZEND_API void zend_alloc_ce_cache(zend_string *type_name)
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format,...)
ZEND_API zend_string * zend_strpprintf_unchecked(size_t max_len, const char *format,...)
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format,...)
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn_unchecked(int type, const char *format,...)
ZEND_API ZEND_COLD void zend_error(int type, const char *format,...)
struct _zend_class_name zend_class_name
struct _zend_trait_precedence zend_trait_precedence
struct _zend_trait_alias zend_trait_alias
struct _zend_trait_method_reference zend_trait_method_reference
ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce, const zend_function *fptr, zend_string *lcname, int error_type)
ZEND_API const char * zend_zval_value_name(const zval *arg)
ZEND_API const char * zend_get_type_by_const(int type)
ZEND_API zend_property_info * zend_declare_typed_property(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment, zend_type type)
ZEND_API zend_result zend_get_default_from_internal_arg_info(zval *default_value_zval, zend_internal_arg_info *arg_info)
ZEND_API const char * zend_zval_type_name(const zval *arg)
ZEND_API zend_class_constant * zend_declare_typed_class_constant(zend_class_entry *ce, zend_string *name, zval *value, int flags, zend_string *doc_comment, zend_type type)
ZEND_API ZEND_COLD void zend_class_redeclaration_error(int type, zend_class_entry *old_ce)
ZEND_API void zend_add_magic_method(zend_class_entry *ce, zend_function *fptr, zend_string *lcname)
ZEND_API zend_class_constant * zend_declare_class_constant_ex(zend_class_entry *ce, zend_string *name, zval *value, int flags, zend_string *doc_comment)
#define ZVAL_STRING(z, s)
#define array_init_size(arg, size)
#define _ZEND_ARG_INFO_FLAGS(pass_by_ref, is_variadic, is_tentative)
#define ZVAL_STRINGL(z, s, l)
#define ZVAL_EMPTY_STRING(z)
#define safe_erealloc(ptr, nmemb, size, offset)
#define efree_size(ptr, size)
#define FREE_HASHTABLE(ht)
#define erealloc(ptr, size)
#define safe_emalloc(nmemb, size, offset)
#define ALLOC_HASHTABLE(ht)
ZEND_API void ZEND_FASTCALL zend_ast_destroy(zend_ast *ast)
ZEND_API void zend_ast_apply(zend_ast *ast, zend_ast_apply_func fn, void *context)
ZEND_API zend_ast_ref *ZEND_FASTCALL zend_ast_copy(zend_ast *ast)
ZEND_API zend_ast *ZEND_FASTCALL zend_ast_create_znode(znode *node)
ZEND_API zend_ast *ZEND_FASTCALL zend_ast_list_add(zend_ast *ast, zend_ast *op)
ZEND_API ZEND_COLD zend_string * zend_ast_export(const char *prefix, zend_ast *ast, const char *suffix)
ZEND_API zend_ast *ZEND_FASTCALL zend_ast_create_zval(zval *zv)
ZEND_API zend_ast *ZEND_FASTCALL zend_ast_create_constant(zend_string *name, zend_ast_attr attr)
ZEND_API zend_ast *ZEND_FASTCALL zend_ast_create_zval_from_str(zend_string *str)
#define zend_ast_create(...)
#define zend_ast_create_ex(...)
struct _zend_ast_list zend_ast_list
#define zend_ast_create_list(init_children,...)
@ ZEND_AST_ASSIGN_COALESCE
@ ZEND_AST_CLASS_CONST_GROUP
@ ZEND_AST_ATTRIBUTE_LIST
@ ZEND_AST_TYPE_INTERSECTION
@ ZEND_AST_TRAIT_PRECEDENCE
@ ZEND_AST_ATTRIBUTE_GROUP
@ ZEND_AST_PARENT_PROPERTY_HOOK_CALL
@ ZEND_AST_CALLABLE_CONVERT
@ ZEND_AST_INCLUDE_OR_EVAL
@ ZEND_AST_CONST_ENUM_INIT
@ ZEND_AST_PROPERTY_HOOK_SHORT_BODY
@ ZEND_AST_NULLSAFE_METHOD_CALL
@ ZEND_AST_CONSTANT_CLASS
struct _zend_ast_decl zend_ast_decl
ZEND_API zend_internal_attribute * zend_internal_attribute_get(zend_string *lcname)
ZEND_API zend_attribute * zend_add_attribute(HashTable **attributes, zend_string *name, uint32_t argc, uint32_t flags, uint32_t offset, uint32_t lineno)
ZEND_API bool zend_is_attribute_repeated(HashTable *attributes, zend_attribute *attr)
ZEND_API zend_string * zend_get_attribute_target_names(uint32_t flags)
ZEND_API zend_attribute * zend_get_attribute_str(HashTable *attributes, const char *str, size_t len)
#define ZEND_ATTRIBUTE_TARGET_METHOD
#define ZEND_ATTRIBUTE_TARGET_PARAMETER
#define ZEND_ATTRIBUTE_IS_REPEATABLE
#define ZEND_ATTRIBUTE_TARGET_ALL
struct _zend_attribute zend_attribute
struct _zend_internal_attribute zend_internal_attribute
#define ZEND_ATTRIBUTE_STRICT_TYPES
#define ZEND_ATTRIBUTE_TARGET_FUNCTION
#define ZEND_ATTRIBUTE_TARGET_CLASS_CONST
#define ZEND_ATTRIBUTE_TARGET_PROPERTY
#define ZEND_ATTRIBUTE_TARGET_CLASS
zend_string_release_ex(func->internal_function.function_name, 0)
ZEND_API zend_result zend_register_auto_global(zend_string *name, bool jit, zend_auto_global_callback auto_global_callback)
ZEND_API bool zend_unary_op_produces_error(uint32_t opcode, const zval *op)
ZEND_API bool zend_is_smart_branch(const zend_op *opline)
ZEND_API zend_string * zend_get_compiled_variable_name(const zend_op_array *op_array, uint32_t var)
#define LITERAL_STR(op, str)
void zend_emit_final_return(bool return_one)
ZEND_API bool zend_is_op_long_compatible(const zval *op)
ZEND_API void zend_restore_compiled_filename(zend_string *original_compiled_filename)
ZEND_API void zend_activate_auto_globals(void)
zend_ast * zend_ast_append_str(zend_ast *left_ast, zend_ast *right_ast)
struct _builtin_type_info builtin_type_info
void zend_const_expr_to_zval(zval *result, zend_ast **ast_ptr, bool allow_dynamic)
void zend_assert_valid_class_name(const zend_string *name, const char *type)
uint32_t zend_modifier_list_to_flags(zend_modifier_target target, zend_ast *modifiers)
ZEND_API void zend_initialize_class_data(zend_class_entry *ce, bool nullify_handlers)
ZEND_API zend_string * zend_set_compiled_filename(zend_string *new_compiled_filename)
ZEND_API bool zend_binary_op_produces_error(uint32_t opcode, const zval *op1, const zval *op2)
void zend_oparray_context_end(zend_oparray_context *prev_context)
uint32_t zend_get_class_fetch_type(const zend_string *name)
#define GET_NODE(target, src)
ZEND_API zend_executor_globals executor_globals
uint32_t zend_modifier_token_to_flag(zend_modifier_target target, uint32_t token)
ZEND_API zend_result do_bind_class(zval *lcname, zend_string *lc_parent_name)
ZEND_API bool zend_is_compiling(void)
struct _zend_loop_var zend_loop_var
uint32_t zend_add_anonymous_class_modifier(uint32_t flags, uint32_t new_flag)
void zend_oparray_context_begin(zend_oparray_context *prev_context, zend_op_array *op_array)
ZEND_API zend_compiler_globals compiler_globals
uint32_t zend_add_class_modifier(uint32_t flags, uint32_t new_flag)
void zend_file_context_begin(zend_file_context *prev_context)
ZEND_API bool zend_is_auto_global_str(const char *name, size_t len)
ZEND_API size_t zend_dirname(char *path, size_t len)
ZEND_API uint8_t zend_get_call_op(const zend_op *init_op, zend_function *fbc)
ZEND_API void zend_set_function_arg_flags(zend_function *func)
ZEND_API zend_string * zend_type_to_string(zend_type type)
ZEND_API int zend_get_compiled_lineno(void)
void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline)
#define SET_NODE(target, src)
ZEND_API zend_class_entry * zend_bind_class_in_slot(zval *class_table_slot, zval *lcname, zend_string *lc_parent_name)
void zend_init_compiler_data_structures(void)
void zend_compile_top_stmt(zend_ast *ast)
#define ZEND_SHORT_CIRCUITING_INNER
zend_string * zval_make_interned_string(zval *zv)
ZEND_API zend_string * zend_mangle_property_name(const char *src1, size_t src1_length, const char *src2, size_t src2_length, bool internal)
zend_property_hook_kind zend_get_property_hook_kind_from_name(zend_string *name)
ZEND_API zend_string * zend_get_compiled_filename(void)
ZEND_API zend_string * zend_create_member_string(zend_string *class_name, zend_string *member_name)
ZEND_API bool zend_is_auto_global(zend_string *name)
zend_ast * zend_negate_num_string(zend_ast *ast)
ZEND_API zend_result do_bind_function(zend_function *func, zval *lcname)
zend_string * zend_type_to_string_resolved(zend_type type, zend_class_entry *scope)
uint32_t zend_add_member_modifier(uint32_t flags, uint32_t new_flag, zend_modifier_target target)
ZEND_API void function_add_ref(zend_function *function)
void shutdown_compiler(void)
ZEND_API zend_result zend_unmangle_property_name_ex(const zend_string *name, const char **class_name, const char **prop_name, size_t *prop_len)
void zend_stop_lexing(void)
bool zend_handle_encoding_declaration(zend_ast *ast)
void zend_file_context_end(zend_file_context *prev_context)
zend_result(ZEND_FASTCALL * binary_op_type)(zval *, zval *, zval *)
struct _zend_oparray_context zend_oparray_context
#define ZEND_PARAM_VARIADIC
struct _zend_brk_cont_element zend_brk_cont_element
#define ZEND_JMP_NULL_BP_VAR_IS
#define ZEND_COMPILE_WITHOUT_EXECUTION
#define ZEND_ACC_USES_THIS
#define ZEND_SYMBOL_FUNCTION
#define ZEND_FETCH_CLASS_SELF
#define ZEND_COMPILE_IGNORE_USER_FUNCTIONS
#define ZEND_FETCH_DIM_REF
#define INITIAL_OP_ARRAY_SIZE
#define ZEND_USER_CODE(type)
#define ZEND_SHORT_CIRCUITING_CHAIN_EXPR
#define ARG_MUST_BE_SENT_BY_REF(zf, arg_num)
#define ZEND_NAME_RELATIVE
#define CT_CONSTANT(node)
#define ZEND_SYMBOL_CONST
#define ZEND_FETCH_CLASS_MASK
#define ZEND_ACC_NOT_SERIALIZABLE
#define ZEND_FETCH_GLOBAL_LOCK
#define ZEND_COMPILE_PRELOAD
#define ZEND_HAS_STATIC_IN_METHODS
#define ZEND_ARRAY_NOT_PACKED
#define ZEND_ACC_HAS_TYPE_HINTS
#define ZEND_ACC_IMPLICIT_ABSTRACT_CLASS
#define ZEND_COMPILE_EXTENDED_STMT
#define ZEND_COMPILE_NO_BUILTINS
struct _zend_label zend_label
ZEND_API void pass_two(zend_op_array *op_array)
#define IS_SMART_BRANCH_JMPNZ
#define ZEND_ACC_STRICT_TYPES
#define ZEND_INTERNAL_FUNCTION
#define ZEND_ACC_DONE_PASS_TWO
#define ZEND_ACC_ABSTRACT
struct _zend_declarables zend_declarables
#define _ZEND_IS_PROMOTED_BIT
#define ZEND_CLASS_CONST_FLAGS(c)
#define ZEND_SHORT_CIRCUITING_CHAIN_EMPTY
#define ZEND_FREE_ON_RETURN
#define ZEND_ACC_PROMOTED
enum _zend_compile_position zend_compile_position
#define ZEND_TYPE_NULLABLE
#define ZEND_ACC_READONLY
#define ZEND_ACC_PROTECTED_SET
#define IS_SMART_BRANCH_JMPZ
#define ZEND_FETCH_DIM_DIM
#define ZEND_ARG_SEND_MODE(arg_info)
#define ZEND_PARENTHESIZED_STATIC_PROP
#define ZEND_ACC_PPP_SET_MASK
#define ZEND_COMPILE_IGNORE_OTHER_FILES
#define ZEND_RETURNS_VALUE
#define ZEND_COMPILE_DELAYED_BINDING
#define ZEND_ARRAY_SYNTAX_LONG
ZEND_API binary_op_type get_binary_op(int opcode)
#define ZEND_FUNCTION_DTOR
#define ZEND_FETCH_CLASS_NO_AUTOLOAD
union _zend_parser_stack_elem zend_parser_stack_elem
#define ZEND_ACC_TOP_LEVEL
#define ZEND_ACC_EXPLICIT_ABSTRACT_CLASS
#define ZEND_USER_FUNCTION
#define ZEND_COMPILE_NO_JUMPTABLES
ZEND_API int ZEND_FASTCALL lex_scan(zval *zendlval, zend_parser_stack_elem *elem)
struct _zend_file_context zend_file_context
#define ZEND_ENCAPS_VAR_DOLLAR_CURLY_VAR_VAR
#define ZEND_ACC_INTERFACE
#define ZEND_ACC_PRIVATE_SET
#define ZEND_ACC_CALL_VIA_TRAMPOLINE
#define ZEND_TOSTRING_FUNC_NAME
#define ZEND_ACC_GENERATOR
struct _zend_op_array zend_op_array
#define ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS
#define ZEND_ACC_READONLY_CLASS
#define ZEND_FCALL_MAY_HAVE_EXTRA_NAMED_PARAMS
#define ZEND_PROPERTY_HOOK_STRUCT_SIZE
struct _zend_class_constant zend_class_constant
struct _zend_property_info zend_property_info
#define ZEND_FETCH_DIM_INCDEC
ZEND_API unary_op_type get_unary_op(int opcode)
#define ZEND_ACC_RESOLVED_PARENT
#define ZEND_COMPILE_IGNORE_INTERNAL_CLASSES
#define ZEND_ACC_PRELOADED
#define ZEND_BIND_IMPLICIT
#define ZEND_ACC_USE_GUARDS
#define ZEND_FETCH_CLASS_STATIC
#define ZEND_THROW_IS_EXPR
#define ZEND_FETCH_DIM_WRITE
#define ZEND_FETCH_CLASS_DEFAULT
#define ZEND_ACC_CONSTANTS_UPDATED
ZEND_API void init_op_array(zend_op_array *op_array, uint8_t type, int initial_ops_size)
struct _zend_internal_arg_info zend_internal_arg_info
#define ZEND_ACC_ANON_CLASS
#define ZEND_COMPILE_EXTENDED_FCALL
#define ZEND_ACC_PPP_MASK
bool(* zend_auto_global_callback)(zend_string *name)
#define ZEND_FETCH_CLASS_EXCEPTION
#define ZEND_FETCH_CLASS_PARENT
#define ZEND_ACC_HAS_RETURN_TYPE
struct _zend_arg_info zend_arg_info
#define ZEND_SYMBOL_CLASS
#define ZEND_ACC_PUBLIC_SET
#define CT_CONSTANT_EX(op_array, num)
ZEND_API void zend_type_release(zend_type type, bool persistent)
#define ZEND_ARRAY_SYNTAX_LIST
#define ZEND_COMPILE_WITH_FILE_CACHE
#define ZEND_SET_ARG_FLAG(zf, arg_num, mask)
#define ZEND_CONST_EXPR_NEW_FETCH_TYPE_SHIFT
#define ZEND_FETCH_GLOBAL
#define ZEND_ACC_VARIADIC
@ ZEND_MODIFIER_TARGET_CONSTANT
@ ZEND_MODIFIER_TARGET_PROPERTY
@ ZEND_MODIFIER_TARGET_PROPERTY_HOOK
@ ZEND_MODIFIER_TARGET_METHOD
@ ZEND_MODIFIER_TARGET_CPP
#define ZEND_ACC_EARLY_BINDING
#define ZEND_ARRAY_SIZE_SHIFT
#define ARG_SHOULD_BE_SENT_BY_REF(zf, arg_num)
#define ZEND_ACC_HAS_FINALLY_BLOCK
struct _zend_auto_global zend_auto_global
#define ZEND_CLASS_CONST_IS_CASE
#define ZEND_COMPILE_NO_PERSISTENT_CONSTANT_SUBSTITUTION
#define ZEND_ACC_OVERRIDE
struct _zend_try_catch_element zend_try_catch_element
#define ZEND_INTERNAL_CLASS
#define ZEND_CONSTRUCTOR_FUNC_NAME
#define ZEND_ACC_DEPRECATED
zend_result(ZEND_FASTCALL * unary_op_type)(zval *, zval *)
#define ZEND_FETCH_CLASS_SILENT
#define IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE
#define ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION
#define ZEND_ACC_RETURN_REFERENCE
#define ZEND_PARENTHESIZED_CONDITIONAL
#define ZEND_COMPILE_GUARDS
#define ZEND_RETURNS_FUNCTION
#define ARG_MAY_BE_SENT_BY_REF(zf, arg_num)
#define ZEND_ACC_PROTECTED
#define ZEND_FETCH_DIM_OBJ
#define ZEND_BIND_EXPLICIT
#define ZEND_ENCAPS_VAR_DOLLAR_CURLY
#define ZEND_SHORT_CIRCUITING_CHAIN_ISSET
ZEND_API void zend_register_long_constant(const char *name, size_t name_len, zend_long lval, int flags, int module_number)
#define ZEND_CONSTANT_FLAGS(c)
#define CONST_NO_FILE_CACHE
struct _zend_constant zend_constant
void zend_enum_register_props(zend_class_entry *ce)
void zend_enum_add_interfaces(zend_class_entry *ce)
#define E_COMPILE_WARNING
ZEND_API zend_class_entry * zend_ce_compile_error
ZEND_API ZEND_COLD zend_object * zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code)
ZEND_API ZEND_COLD zend_object * zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format,...)
ZEND_API zend_class_entry * zend_get_called_scope(zend_execute_data *ex)
ZEND_API zend_string * get_function_or_method_name(const zend_function *func)
ZEND_API void(* zend_execute_ex)(zend_execute_data *execute_data)
ZEND_API void(* zend_execute_internal)(zend_execute_data *execute_data, zval *return_value)
ZEND_API void execute_ex(zend_execute_data *execute_data)
ZEND_API zend_class_entry * zend_lookup_class_ex(zend_string *name, zend_string *lcname, uint32_t flags)
ZEND_API void ** zend_flf_handlers
union _zend_function zend_function
#define ZEND_OP_IS_FRAMELESS_ICALL(opcode)
struct _zend_executor_globals zend_executor_globals
struct _zend_compiler_globals zend_compiler_globals
ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht)
ZEND_API zval *ZEND_FASTCALL zend_hash_set_bucket_key(HashTable *ht, Bucket *b, zend_string *key)
ZEND_API zval *ZEND_FASTCALL zend_hash_index_add(HashTable *ht, zend_ulong h, zval *pData)
ZEND_API zval *ZEND_FASTCALL zend_hash_next_index_insert(HashTable *ht, zval *pData)
ZEND_API void * zend_hash_str_find_ptr_lc(const HashTable *ht, const char *str, size_t len)
ZEND_API void ZEND_FASTCALL zend_hash_clean(HashTable *ht)
ZEND_API zval *ZEND_FASTCALL zend_hash_add_new(HashTable *ht, zend_string *key, zval *pData)
ZEND_API zval *ZEND_FASTCALL zend_hash_find_known_hash(const HashTable *ht, const zend_string *key)
ZEND_API zval *ZEND_FASTCALL zend_hash_index_update(HashTable *ht, zend_ulong h, zval *pData)
ZEND_API void ZEND_FASTCALL zend_array_destroy(HashTable *ht)
ZEND_API zval *ZEND_FASTCALL zend_hash_update(HashTable *ht, zend_string *key, zval *pData)
ZEND_API void * zend_hash_find_ptr_lc(const HashTable *ht, zend_string *key)
ZEND_API zval *ZEND_FASTCALL zend_hash_add_empty_element(HashTable *ht, zend_string *key)
ZEND_API zend_result ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key)
ZEND_API zval *ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key)
ZEND_API zval *ZEND_FASTCALL zend_hash_add(HashTable *ht, zend_string *key, zval *pData)
ZEND_API zval *ZEND_FASTCALL zend_hash_index_find(const HashTable *ht, zend_ulong h)
#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent)
#define ZEND_HASH_MAP_FOREACH_PTR(ht, _ptr)
#define ZEND_HASH_PACKED_FOREACH_PTR(ht, _ptr)
#define ZEND_HASH_FOREACH_PTR(ht, _ptr)
#define zend_new_array(size)
#define ZEND_HANDLE_NUMERIC(key, idx)
#define ZEND_HASH_FOREACH_STR_KEY_VAL(ht, _key, _val)
#define ZEND_HASH_MAP_FOREACH_STR_KEY(ht, _key)
#define ZEND_HASH_MAP_REVERSE_FOREACH_PTR(ht, _ptr)
#define ZEND_HASH_FOREACH_END()
#define ZVAL_EMPTY_ARRAY(z)
#define ZEND_HASH_FOREACH_VAL(ht, _val)
ZEND_API zend_class_entry * zend_try_early_bind(zend_class_entry *ce, zend_class_entry *parent_ce, zend_string *lcname, zval *delayed_early_binding)
void zend_inheritance_check_override(zend_class_entry *ce)
ZEND_API ZEND_COLD ZEND_NORETURN void zend_hooked_property_variance_error(const zend_property_info *prop_info)
void zend_build_properties_info_table(zend_class_entry *ce)
ZEND_API void zend_verify_hooked_property(zend_class_entry *ce, zend_property_info *prop_info, zend_string *prop_name)
ZEND_API zend_class_entry * zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name, zend_string *key)
ZEND_API inheritance_status zend_verify_property_hook_variance(const zend_property_info *prop_info, const zend_function *func)
ZEND_API ZEND_COLD ZEND_NORETURN void zend_hooked_property_variance_error_ex(zend_string *value_param_name, zend_string *class_name, zend_string *prop_name)
void zend_verify_abstract_class(zend_class_entry *ce)
struct _zend_file_handle zend_file_handle
ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding)
ZEND_API zend_result zend_multibyte_set_filter(const zend_encoding *onetime_encoding)
ZEND_API void zend_init_rsrc_list(void)
struct _zend_string zend_string
#define ZEND_MAP_PTR_INIT(ptr, val)
#define ZEND_MAP_PTR_NEW(ptr)
ZEND_API const zend_encoding * zend_multibyte_fetch_encoding(const char *name)
size_t(* zend_encoding_filter)(unsigned char **str, size_t *str_length, const unsigned char *buf, size_t length)
struct _zend_encoding zend_encoding
ZEND_API bool zend_check_protected(const zend_class_entry *ce, const zend_class_entry *scope)
ZEND_API const zend_object_handlers std_object_handlers
#define zend_get_function_root_class(fbc)
ZEND_API int ZEND_FASTCALL zend_binary_strcasecmp(const char *s1, size_t len1, const char *s2, size_t len2)
ZEND_API char *ZEND_FASTCALL zend_str_tolower_copy(char *dest, const char *source, size_t length)
ZEND_API zend_string *ZEND_FASTCALL zend_string_tolower_ex(zend_string *str, bool persistent)
ZEND_API zend_result ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2)
ZEND_API void ZEND_FASTCALL convert_to_double(zval *op)
ZEND_API bool ZEND_FASTCALL zend_is_true(const zval *op)
ZEND_API uint8_t ZEND_FASTCALL is_numeric_str_function(const zend_string *str, zend_long *lval, double *dval)
ZEND_API zend_result ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2)
ZEND_API void ZEND_FASTCALL zend_str_tolower(char *str, size_t length)
ZEND_API zend_string *ZEND_FASTCALL zval_get_string_func(zval *op)
ZEND_API zend_result ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2)
#define convert_to_string(op)
#define ALLOCA_FLAG(name)
#define zend_never_inline
#define ZEND_IGNORE_VALUE(x)
#define EXPECTED(condition)
#define do_alloca(p, use_heap)
#define zend_always_inline
#define XtOffsetOf(s_type, field)
#define ZEND_UNREACHABLE()
#define free_alloca(p, use_heap)
#define EMPTY_SWITCH_DEFAULT_CASE()
#define UNEXPECTED(condition)
ZEND_API zend_object_iterator * zend_hooked_object_get_iterator(zend_class_entry *ce, zval *object, int by_ref)
struct _zend_array zend_array
struct _zend_class_entry zend_class_entry
ZEND_API int zend_stack_push(zend_stack *stack, const void *element)
ZEND_API void * zend_stack_base(const zend_stack *stack)
ZEND_API void * zend_stack_top(const zend_stack *stack)
ZEND_API int zend_stack_count(const zend_stack *stack)
ZEND_API void zend_stack_destroy(zend_stack *stack)
ZEND_API void zend_stack_init(zend_stack *stack, int size)
ZEND_API void zend_stack_del_top(zend_stack *stack)
void zend_stream_init(void)
ZEND_API zend_string * zend_string_concat2(const char *str1, size_t str1_len, const char *str2, size_t str2_len)
ZEND_API zend_string * zend_string_concat3(const char *str1, size_t str1_len, const char *str2, size_t str2_len, const char *str3, size_t str3_len)
ZEND_API zend_new_interned_string_func_t zend_new_interned_string
ZEND_API zend_string * zend_empty_string
#define ZSTR_IS_INTERNED(s)
#define ZSTR_INIT_LITERAL(s, persistent)
#define zend_string_equals_literal(str, literal)
#define ZSTR_EMPTY_ALLOC()
#define zend_string_equals_ci(s1, s2)
#define zend_string_equals_literal_ci(str, c)
#define ZEND_TYPE_IS_ITERABLE_FALLBACK(t)
#define ZEND_TYPE_PURE_MASK(t)
#define Z_TRY_ADDREF_P(pz)
#define ZEND_TYPE_NAME(t)
#define ZEND_TYPE_INIT_MASK(_type_mask)
#define Z_STRVAL_P(zval_p)
#define Z_ARRVAL_P(zval_p)
#define _ZEND_TYPE_ARENA_BIT
#define ZEND_TYPE_IS_INTERSECTION(t)
#define ZVAL_STR_COPY(z, s)
struct _zend_array HashTable
#define ZVAL_COPY_OR_DUP(z, v)
#define ZEND_TYPE_LIST_SIZE(num_types)
#define ZEND_TYPE_HAS_NAME(t)
#define ZEND_TYPE_IS_UNION(t)
#define _ZEND_TYPE_INTERSECTION_BIT
#define ZEND_TYPE_FULL_MASK(t)
#define ZEND_TYPE_FOREACH(type, type_ptr)
#define ZEND_TYPE_HAS_LIST(t)
#define Z_STRLEN_P(zval_p)
#define ZEND_TYPE_LIST_FOREACH_END()
#define ZEND_TYPE_INIT_NONE(extra_flags)
#define ZEND_TYPE_SET_LIST(t, list)
#define ZEND_TYPE_INIT_CODE(code, allow_null, extra_flags)
#define ZEND_TYPE_IS_ONLY_MASK(t)
#define ZEND_TYPE_IS_SET(t)
#define _ZEND_TYPE_UNION_BIT
#define ZEND_TYPE_FOREACH_END()
#define ZVAL_NEW_STR(z, s)
#define _ZEND_TYPE_NAME_BIT
#define ZEND_TYPE_INIT_CLASS_MASK(class_name, type_mask)
ZEND_RESULT_CODE zend_result
#define Z_TYPE_FLAGS_P(zval_p)
#define ZEND_TYPE_SET_PTR(t, _ptr)
#define ZEND_TYPE_INIT_CLASS(class_name, allow_null, extra_flags)
#define ZEND_TYPE_ALLOW_NULL(t)
#define ZEND_TYPE_LIST_FOREACH(list, type_ptr)
#define ZEND_TYPE_CONTAINS_CODE(t, code)
#define ZEND_TYPE_LIST(t)
struct _zend_ast zend_ast
#define ZVAL_COPY_VALUE(z, v)
#define Z_EXTRA_P(zval_p)
#define _ZEND_TYPE_MAY_BE_MASK
#define _ZEND_TYPE_ITERABLE_BIT
#define ZEND_TYPE_IS_COMPLEX(t)
ZEND_API void zval_ptr_dtor(zval *zval_ptr)
#define IS_SLASH_P_EX(c, first_byte)
#define VCWD_GETCWD(buff, size)
#define ZEND_VM_SET_OPCODE_HANDLER(opline)
zend_property_info * prop_info
fbc internal_function handler(call, ret)
function(EX_VAR(opline->result.var))
#define ZEND_IS_IDENTICAL
#define ZEND_DECLARE_ANON_CLASS
#define ZEND_FETCH_CONSTANT
#define ZEND_ASSIGN_DIM_OP
#define ZEND_ASSIGN_STATIC_PROP_REF
#define ZEND_UNSET_STATIC_PROP
#define ZEND_EXT_FCALL_END
#define ZEND_ISSET_ISEMPTY_CV
#define ZEND_VERIFY_RETURN_TYPE
#define ZEND_FETCH_LIST_R
#define ZEND_FUNC_NUM_ARGS
#define ZEND_INCLUDE_OR_EVAL
#define ZEND_GENERATOR_CREATE
#define ZEND_INIT_USER_CALL
#define ZEND_FRAMELESS_ICALL_0
#define ZEND_FETCH_LIST_W
#define ZEND_CALLABLE_CONVERT
#define ZEND_ASSERT_CHECK
#define ZEND_RETURN_BY_REF
#define ZEND_SWITCH_STRING
#define ZEND_DECLARE_CONST
#define ZEND_DECLARE_CLASS_DELAYED
#define ZEND_GET_CALLED_CLASS
#define ZEND_DECLARE_FUNCTION
#define ZEND_FETCH_STATIC_PROP_R
#define ZEND_PRE_DEC_STATIC_PROP
#define ZEND_ASSIGN_STATIC_PROP_OP
#define ZEND_FETCH_DIM_FUNC_ARG
#define ZEND_FETCH_GLOBALS
#define ZEND_EXT_FCALL_BEGIN
#define ZEND_POST_INC_STATIC_PROP
#define ZEND_IS_NOT_EQUAL
#define ZEND_IS_NOT_IDENTICAL
#define ZEND_POST_DEC_OBJ
#define ZEND_CHECK_FUNC_ARG
#define ZEND_ISSET_ISEMPTY_PROP_OBJ
#define ZEND_INIT_NS_FCALL_BY_NAME
#define ZEND_ADD_ARRAY_ELEMENT
#define ZEND_ISSET_ISEMPTY_STATIC_PROP
#define ZEND_ASSIGN_STATIC_PROP
#define ZEND_IS_SMALLER_OR_EQUAL
#define ZEND_POST_DEC_STATIC_PROP
#define ZEND_INIT_FCALL_BY_NAME
#define ZEND_DISCARD_EXCEPTION
#define ZEND_PRE_INC_STATIC_PROP
#define ZEND_SEND_VAR_NO_REF_EX
#define ZEND_BIND_LEXICAL
#define ZEND_DECLARE_LAMBDA_FUNCTION
#define ZEND_SEND_FUNC_ARG
#define ZEND_CHECK_UNDEF_ARGS
#define ZEND_ISSET_ISEMPTY_DIM_OBJ
#define ZEND_ISSET_ISEMPTY_VAR
#define ZEND_BIND_INIT_STATIC_OR_JMP
#define ZEND_DECLARE_CLASS
#define ZEND_ADD_ARRAY_UNPACK
#define ZEND_BEGIN_SILENCE
#define ZEND_FUNC_GET_ARGS
#define ZEND_ARRAY_KEY_EXISTS
#define ZEND_JMP_FRAMELESS
#define ZEND_INIT_DYNAMIC_CALL
#define ZEND_INIT_PARENT_PROPERTY_HOOK_CALL
#define ZEND_FETCH_STATIC_PROP_W
#define ZEND_ASSIGN_OBJ_OP
#define ZEND_ASSIGN_OBJ_REF
#define ZEND_FETCH_CLASS_CONSTANT
#define ZEND_RECV_VARIADIC
#define ZEND_VERIFY_NEVER_TYPE
#define ZEND_FETCH_DIM_UNSET
#define ZEND_SEND_VAR_NO_REF
#define ZEND_POST_INC_OBJ
#define ZEND_DO_FCALL_BY_NAME
#define ZEND_INIT_METHOD_CALL
#define ZEND_INIT_STATIC_METHOD_CALL
#define ZEND_ISSET_ISEMPTY_THIS
#define ZEND_FETCH_CLASS_NAME
#define ZEND_FETCH_DIM_RW