Lines Matching refs:ce
57 static zend_function *zend_duplicate_function(zend_function *func, zend_class_entry *ce) /* {{{ */ in zend_duplicate_function() argument
62 if (UNEXPECTED(ce->type & ZEND_INTERNAL_CLASS)) { in zend_duplicate_function()
91 static void do_inherit_parent_constructor(zend_class_entry *ce) /* {{{ */ in do_inherit_parent_constructor() argument
93 ZEND_ASSERT(ce->parent != NULL); in do_inherit_parent_constructor()
96 ce->create_object = ce->parent->create_object; in do_inherit_parent_constructor()
99 if (EXPECTED(!ce->get_iterator)) { in do_inherit_parent_constructor()
100 ce->get_iterator = ce->parent->get_iterator; in do_inherit_parent_constructor()
102 if (EXPECTED(!ce->iterator_funcs_ptr) && UNEXPECTED(ce->parent->iterator_funcs_ptr)) { in do_inherit_parent_constructor()
103 if (ce->type == ZEND_INTERNAL_CLASS) { in do_inherit_parent_constructor()
104 ce->iterator_funcs_ptr = calloc(1, sizeof(zend_class_iterator_funcs)); in do_inherit_parent_constructor()
105 if (ce->parent->iterator_funcs_ptr->zf_new_iterator) { in do_inherit_parent_constructor()
106 …ce->iterator_funcs_ptr->zf_new_iterator = zend_hash_str_find_ptr(&ce->function_table, "getiterator… in do_inherit_parent_constructor()
108 if (ce->parent->iterator_funcs_ptr->zf_current) { in do_inherit_parent_constructor()
109 …ce->iterator_funcs_ptr->zf_rewind = zend_hash_str_find_ptr(&ce->function_table, "rewind", sizeof("… in do_inherit_parent_constructor()
110 …ce->iterator_funcs_ptr->zf_valid = zend_hash_str_find_ptr(&ce->function_table, "valid", sizeof("va… in do_inherit_parent_constructor()
111 …ce->iterator_funcs_ptr->zf_key = zend_hash_str_find_ptr(&ce->function_table, "key", sizeof("key") … in do_inherit_parent_constructor()
112 …ce->iterator_funcs_ptr->zf_current = zend_hash_str_find_ptr(&ce->function_table, "current", sizeof… in do_inherit_parent_constructor()
113 …ce->iterator_funcs_ptr->zf_next = zend_hash_str_find_ptr(&ce->function_table, "next", sizeof("next… in do_inherit_parent_constructor()
116 ce->iterator_funcs_ptr = zend_arena_alloc(&CG(arena), sizeof(zend_class_iterator_funcs)); in do_inherit_parent_constructor()
117 memset(ce->iterator_funcs_ptr, 0, sizeof(zend_class_iterator_funcs)); in do_inherit_parent_constructor()
120 if (EXPECTED(!ce->__get)) { in do_inherit_parent_constructor()
121 ce->__get = ce->parent->__get; in do_inherit_parent_constructor()
123 if (EXPECTED(!ce->__set)) { in do_inherit_parent_constructor()
124 ce->__set = ce->parent->__set; in do_inherit_parent_constructor()
126 if (EXPECTED(!ce->__unset)) { in do_inherit_parent_constructor()
127 ce->__unset = ce->parent->__unset; in do_inherit_parent_constructor()
129 if (EXPECTED(!ce->__isset)) { in do_inherit_parent_constructor()
130 ce->__isset = ce->parent->__isset; in do_inherit_parent_constructor()
132 if (EXPECTED(!ce->__call)) { in do_inherit_parent_constructor()
133 ce->__call = ce->parent->__call; in do_inherit_parent_constructor()
135 if (EXPECTED(!ce->__callstatic)) { in do_inherit_parent_constructor()
136 ce->__callstatic = ce->parent->__callstatic; in do_inherit_parent_constructor()
138 if (EXPECTED(!ce->__tostring)) { in do_inherit_parent_constructor()
139 ce->__tostring = ce->parent->__tostring; in do_inherit_parent_constructor()
141 if (EXPECTED(!ce->clone)) { in do_inherit_parent_constructor()
142 ce->clone = ce->parent->clone; in do_inherit_parent_constructor()
144 if (EXPECTED(!ce->serialize)) { in do_inherit_parent_constructor()
145 ce->serialize = ce->parent->serialize; in do_inherit_parent_constructor()
147 if (EXPECTED(!ce->unserialize)) { in do_inherit_parent_constructor()
148 ce->unserialize = ce->parent->unserialize; in do_inherit_parent_constructor()
150 if (!ce->destructor) { in do_inherit_parent_constructor()
151 ce->destructor = ce->parent->destructor; in do_inherit_parent_constructor()
153 if (EXPECTED(!ce->__debugInfo)) { in do_inherit_parent_constructor()
154 ce->__debugInfo = ce->parent->__debugInfo; in do_inherit_parent_constructor()
157 if (ce->constructor) { in do_inherit_parent_constructor()
158 …if (ce->parent->constructor && UNEXPECTED(ce->parent->constructor->common.fn_flags & ZEND_ACC_FINA… in do_inherit_parent_constructor()
160 ZSTR_VAL(ce->parent->name), ZSTR_VAL(ce->parent->constructor->common.function_name), in do_inherit_parent_constructor()
161 ZSTR_VAL(ce->name), ZSTR_VAL(ce->constructor->common.function_name)); in do_inherit_parent_constructor()
166 ce->constructor = ce->parent->constructor; in do_inherit_parent_constructor()
639 …unction *do_inherit_method(zend_string *key, zend_function *parent, zend_class_entry *ce) /* {{{ */ in do_inherit_method() argument
641 zval *child = zend_hash_find_ex(&ce->function_table, key, 1); in do_inherit_method()
650 func->common.scope != ce && in do_inherit_method()
662 ce->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS; in do_inherit_method()
665 return zend_duplicate_function(parent, ce); in do_inherit_method()
669 …inherit_property(zend_property_info *parent_info, zend_string *key, zend_class_entry *ce) /* {{{ */ in do_inherit_property() argument
671 zval *child = zend_hash_find_ex(&ce->properties_info, key, 1); in do_inherit_property()
681 …(parent_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ZSTR_VAL(ce->parent->name), ZS… in do_inherit_property()
682 …(child_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ZSTR_VAL(ce->name), ZSTR_VAL(ke… in do_inherit_property()
690 …be %s (as in class %s)%s", ZSTR_VAL(ce->name), ZSTR_VAL(key), zend_visibility_string(parent_info->… in do_inherit_property()
696 zval_ptr_dtor_nogc(&(ce->default_properties_table[parent_num])); in do_inherit_property()
697 ce->default_properties_table[parent_num] = ce->default_properties_table[child_num]; in do_inherit_property()
698 ZVAL_UNDEF(&ce->default_properties_table[child_num]); in do_inherit_property()
704 if (UNEXPECTED(ce->type & ZEND_INTERNAL_CLASS)) { in do_inherit_property()
712 if (UNEXPECTED(ce->type & ZEND_INTERNAL_CLASS)) { in do_inherit_property()
718 _zend_hash_append_ptr(&ce->properties_info, key, child_info); in do_inherit_property()
723 static inline void do_implement_interface(zend_class_entry *ce, zend_class_entry *iface) /* {{{ */ in do_implement_interface() argument
725 …if (!(ce->ce_flags & ZEND_ACC_INTERFACE) && iface->interface_gets_implemented && iface->interface_… in do_implement_interface()
726 …zend_error_noreturn(E_CORE_ERROR, "Class %s could not implement interface %s", ZSTR_VAL(ce->name),… in do_implement_interface()
728 if (UNEXPECTED(ce == iface)) { in do_implement_interface()
729 zend_error_noreturn(E_ERROR, "Interface %s cannot implement itself", ZSTR_VAL(ce->name)); in do_implement_interface()
734 ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_entry *iface) /* {{… in zend_do_inherit_interfaces() argument
743 ce_num = ce->num_interfaces; in zend_do_inherit_interfaces()
745 if (ce->type == ZEND_INTERNAL_CLASS) { in zend_do_inherit_interfaces()
746 …ce->interfaces = (zend_class_entry **) realloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_nu… in zend_do_inherit_interfaces()
748 …ce->interfaces = (zend_class_entry **) erealloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_n… in zend_do_inherit_interfaces()
755 if (ce->interfaces[i] == entry) { in zend_do_inherit_interfaces()
760 ce->interfaces[ce->num_interfaces++] = entry; in zend_do_inherit_interfaces()
765 while (ce_num < ce->num_interfaces) { in zend_do_inherit_interfaces()
766 do_implement_interface(ce, ce->interfaces[ce_num++]); in zend_do_inherit_interfaces()
771 …lass_constant(zend_string *name, zend_class_constant *parent_const, zend_class_entry *ce) /* {{{ */ in do_inherit_class_constant() argument
773 zval *zv = zend_hash_find_ex(&ce->constants_table, name, 1); in do_inherit_class_constant()
780 …ZSTR_VAL(ce->name), ZSTR_VAL(name), zend_visibility_string(Z_ACCESS_FLAGS(parent_const->value)), Z… in do_inherit_class_constant()
784 ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED; in do_inherit_class_constant()
786 if (ce->type & ZEND_INTERNAL_CLASS) { in do_inherit_class_constant()
791 _zend_hash_append_ptr(&ce->constants_table, name, parent_const); in do_inherit_class_constant()
796 ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce) /* {{{ */ in zend_do_inheritance() argument
802 if (UNEXPECTED(ce->ce_flags & ZEND_ACC_INTERFACE)) { in zend_do_inheritance()
805 …zend_error_noreturn(E_COMPILE_ERROR, "Interface %s may not inherit from class (%s)", ZSTR_VAL(ce->… in zend_do_inheritance()
810 …zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend from interface %s", ZSTR_VAL(ce->name… in zend_do_inheritance()
812 …zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend from trait %s", ZSTR_VAL(ce->name), Z… in zend_do_inheritance()
817 …_COMPILE_ERROR, "Class %s may not inherit from final class (%s)", ZSTR_VAL(ce->name), ZSTR_VAL(par… in zend_do_inheritance()
821 ce->parent = parent_ce; in zend_do_inheritance()
824 zend_do_inherit_interfaces(ce, parent_ce); in zend_do_inheritance()
830 if (ce->default_properties_count) { in zend_do_inheritance()
831 …zval *table = pemalloc(sizeof(zval) * (ce->default_properties_count + parent_ce->default_propertie… in zend_do_inheritance()
832 src = ce->default_properties_table + ce->default_properties_count; in zend_do_inheritance()
834 dst = end + ce->default_properties_count; in zend_do_inheritance()
835 ce->default_properties_table = table; in zend_do_inheritance()
841 pefree(src, ce->type == ZEND_INTERNAL_CLASS); in zend_do_inheritance()
842 end = ce->default_properties_table; in zend_do_inheritance()
844 …end = pemalloc(sizeof(zval) * parent_ce->default_properties_count, ce->type == ZEND_INTERNAL_CLASS… in zend_do_inheritance()
846 ce->default_properties_table = end; in zend_do_inheritance()
849 if (UNEXPECTED(parent_ce->type != ce->type)) { in zend_do_inheritance()
856 ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED; in zend_do_inheritance()
866 ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED; in zend_do_inheritance()
871 ce->default_properties_count += parent_ce->default_properties_count; in zend_do_inheritance()
877 if (ce->default_static_members_count) { in zend_do_inheritance()
878 …al *table = pemalloc(sizeof(zval) * (ce->default_static_members_count + parent_ce->default_static_… in zend_do_inheritance()
879 src = ce->default_static_members_table + ce->default_static_members_count; in zend_do_inheritance()
881 dst = end + ce->default_static_members_count; in zend_do_inheritance()
882 ce->default_static_members_table = table; in zend_do_inheritance()
888 pefree(src, ce->type == ZEND_INTERNAL_CLASS); in zend_do_inheritance()
889 end = ce->default_static_members_table; in zend_do_inheritance()
891 …end = pemalloc(sizeof(zval) * parent_ce->default_static_members_count, ce->type == ZEND_INTERNAL_C… in zend_do_inheritance()
893 ce->default_static_members_table = end; in zend_do_inheritance()
895 if (UNEXPECTED(parent_ce->type != ce->type)) { in zend_do_inheritance()
913 } else if (ce->type == ZEND_USER_CLASS) { in zend_do_inheritance()
924 ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED; in zend_do_inheritance()
939 ce->default_static_members_count += parent_ce->default_static_members_count; in zend_do_inheritance()
940 if (ce->type == ZEND_USER_CLASS) { in zend_do_inheritance()
941 ce->static_members_table = ce->default_static_members_table; in zend_do_inheritance()
945 ZEND_HASH_FOREACH_PTR(&ce->properties_info, property_info) { in zend_do_inheritance()
946 if (property_info->ce == ce) { in zend_do_inheritance()
956 zend_hash_extend(&ce->properties_info, in zend_do_inheritance()
957 zend_hash_num_elements(&ce->properties_info) + in zend_do_inheritance()
961 do_inherit_property(property_info, key, ce); in zend_do_inheritance()
968 zend_hash_extend(&ce->constants_table, in zend_do_inheritance()
969 zend_hash_num_elements(&ce->constants_table) + in zend_do_inheritance()
973 do_inherit_class_constant(key, c, ce); in zend_do_inheritance()
978 zend_hash_extend(&ce->function_table, in zend_do_inheritance()
979 zend_hash_num_elements(&ce->function_table) + in zend_do_inheritance()
983 zend_function *new_func = do_inherit_method(key, func, ce); in zend_do_inheritance()
986 _zend_hash_append_ptr(&ce->function_table, key, new_func); in zend_do_inheritance()
991 do_inherit_parent_constructor(ce); in zend_do_inheritance()
993 if (ce->ce_flags & ZEND_ACC_IMPLICIT_ABSTRACT_CLASS && ce->type == ZEND_INTERNAL_CLASS) { in zend_do_inheritance()
994 ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; in zend_do_inheritance()
995 } else if (!(ce->ce_flags & (ZEND_ACC_IMPLEMENT_INTERFACES|ZEND_ACC_IMPLEMENT_TRAITS))) { in zend_do_inheritance()
997 zend_verify_abstract_class(ce); in zend_do_inheritance()
999 ce->ce_flags |= parent_ce->ce_flags & (ZEND_HAS_STATIC_IN_METHODS | ZEND_ACC_USE_GUARDS); in zend_do_inheritance()
1010 if (old_constant->ce != parent_constant->ce) { in do_inherit_constant_check()
1019 …face_constant(zend_string *name, zend_class_constant *c, zend_class_entry *ce, zend_class_entry *i… in do_inherit_iface_constant() argument
1021 if (do_inherit_constant_check(&ce->constants_table, c, name, iface)) { in do_inherit_iface_constant()
1024 ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED; in do_inherit_iface_constant()
1026 if (ce->type & ZEND_INTERNAL_CLASS) { in do_inherit_iface_constant()
1031 zend_hash_update_ptr(&ce->constants_table, name, c); in do_inherit_iface_constant()
1036 ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface) /* {{{ */ in zend_do_implement_interface() argument
1039 uint32_t current_iface_num = ce->num_interfaces; in zend_do_implement_interface()
1040 uint32_t parent_iface_num = ce->parent ? ce->parent->num_interfaces : 0; in zend_do_implement_interface()
1045 for (i = 0; i < ce->num_interfaces; i++) { in zend_do_implement_interface()
1046 if (ce->interfaces[i] == NULL) { in zend_do_implement_interface()
1047 …memmove(ce->interfaces + i, ce->interfaces + i + 1, sizeof(zend_class_entry*) * (--ce->num_interfa… in zend_do_implement_interface()
1049 } else if (ce->interfaces[i] == iface) { in zend_do_implement_interface()
1053 … "Class %s cannot implement previously implemented interface %s", ZSTR_VAL(ce->name), ZSTR_VAL(ifa… in zend_do_implement_interface()
1059 ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->constants_table, key, c) { in zend_do_implement_interface()
1063 if (ce->num_interfaces >= current_iface_num) { in zend_do_implement_interface()
1064 if (ce->type == ZEND_INTERNAL_CLASS) { in zend_do_implement_interface()
1065 …ce->interfaces = (zend_class_entry **) realloc(ce->interfaces, sizeof(zend_class_entry *) * (++cur… in zend_do_implement_interface()
1067 …ce->interfaces = (zend_class_entry **) erealloc(ce->interfaces, sizeof(zend_class_entry *) * (++cu… in zend_do_implement_interface()
1070 ce->interfaces[ce->num_interfaces++] = iface; in zend_do_implement_interface()
1073 do_inherit_iface_constant(key, c, ce, iface); in zend_do_implement_interface()
1077 zend_function *new_func = do_inherit_method(key, func, ce); in zend_do_implement_interface()
1080 zend_hash_add_new_ptr(&ce->function_table, key, new_func); in zend_do_implement_interface()
1084 do_implement_interface(ce, iface); in zend_do_implement_interface()
1085 zend_do_inherit_interfaces(ce, iface); in zend_do_implement_interface()
1090 ZEND_API void zend_do_implement_trait(zend_class_entry *ce, zend_class_entry *trait) /* {{{ */ in zend_do_implement_trait() argument
1093 uint32_t current_trait_num = ce->num_traits; in zend_do_implement_trait()
1094 uint32_t parent_trait_num = ce->parent ? ce->parent->num_traits : 0; in zend_do_implement_trait()
1096 for (i = 0; i < ce->num_traits; i++) { in zend_do_implement_trait()
1097 if (ce->traits[i] == NULL) { in zend_do_implement_trait()
1098 memmove(ce->traits + i, ce->traits + i + 1, sizeof(zend_class_entry*) * (--ce->num_traits - i)); in zend_do_implement_trait()
1100 } else if (ce->traits[i] == trait) { in zend_do_implement_trait()
1107 if (ce->num_traits >= current_trait_num) { in zend_do_implement_trait()
1108 if (ce->type == ZEND_INTERNAL_CLASS) { in zend_do_implement_trait()
1109 …ce->traits = (zend_class_entry **) realloc(ce->traits, sizeof(zend_class_entry *) * (++current_tra… in zend_do_implement_trait()
1111 …ce->traits = (zend_class_entry **) erealloc(ce->traits, sizeof(zend_class_entry *) * (++current_tr… in zend_do_implement_trait()
1114 ce->traits[ce->num_traits++] = trait; in zend_do_implement_trait()
1130 static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zend_function* fe) /* … in zend_add_magic_methods() argument
1132 …if (ZSTR_LEN(ce->name) != ZSTR_LEN(mname) && (ZSTR_VAL(mname)[0] != '_' || ZSTR_VAL(mname)[1] != '… in zend_add_magic_methods()
1135 ce->clone = fe; in zend_add_magic_methods()
1137 if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) { in zend_add_magic_methods()
1138 …_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ZSTR_VAL(ce->name)); in zend_add_magic_methods()
1140 ce->constructor = fe; fe->common.fn_flags |= ZEND_ACC_CTOR; in zend_add_magic_methods()
1142 ce->destructor = fe; fe->common.fn_flags |= ZEND_ACC_DTOR; in zend_add_magic_methods()
1144 ce->__get = fe; in zend_add_magic_methods()
1145 ce->ce_flags |= ZEND_ACC_USE_GUARDS; in zend_add_magic_methods()
1147 ce->__set = fe; in zend_add_magic_methods()
1148 ce->ce_flags |= ZEND_ACC_USE_GUARDS; in zend_add_magic_methods()
1150 ce->__call = fe; in zend_add_magic_methods()
1152 ce->__unset = fe; in zend_add_magic_methods()
1153 ce->ce_flags |= ZEND_ACC_USE_GUARDS; in zend_add_magic_methods()
1155 ce->__isset = fe; in zend_add_magic_methods()
1156 ce->ce_flags |= ZEND_ACC_USE_GUARDS; in zend_add_magic_methods()
1158 ce->__callstatic = fe; in zend_add_magic_methods()
1160 ce->__tostring = fe; in zend_add_magic_methods()
1162 ce->__debugInfo = fe; in zend_add_magic_methods()
1163 } else if (ZSTR_LEN(ce->name) == ZSTR_LEN(mname)) { in zend_add_magic_methods()
1164 zend_string *lowercase_name = zend_string_tolower(ce->name); in zend_add_magic_methods()
1167 if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) { in zend_add_magic_methods()
1168 …_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ZSTR_VAL(ce->name)); in zend_add_magic_methods()
1170 ce->constructor = fe; in zend_add_magic_methods()
1178 static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_string *key, zend_fu… in zend_add_trait_method() argument
1183 if ((existing_fn = zend_hash_find_ptr(&ce->function_table, key)) != NULL) { in zend_add_trait_method()
1192 if (existing_fn->common.scope == ce) { in zend_add_trait_method()
1241 name, ZSTR_VAL(ce->name)); in zend_add_trait_method()
1245 ZSTR_VAL(ce->name), name, in zend_add_trait_method()
1265 fn = zend_hash_update_ptr(&ce->function_table, key, new_fn); in zend_add_trait_method()
1266 zend_add_magic_methods(ce, key, fn); in zend_add_trait_method()
1270 static void zend_fixup_trait_method(zend_function *fn, zend_class_entry *ce) /* {{{ */ in zend_fixup_trait_method() argument
1274 fn->common.scope = ce; in zend_fixup_trait_method()
1277 ce->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS; in zend_fixup_trait_method()
1280 ce->ce_flags |= ZEND_HAS_STATIC_IN_METHODS; in zend_fixup_trait_method()
1286 static int zend_traits_copy_functions(zend_string *fnname, zend_function *fn, zend_class_entry *ce,… in zend_traits_copy_functions() argument
1294 if (ce->trait_aliases) { in zend_traits_copy_functions()
1295 alias_ptr = ce->trait_aliases; in zend_traits_copy_functions()
1312 zend_add_trait_method(ce, ZSTR_VAL(alias->alias), lcname, &fn_copy, overriden); in zend_traits_copy_functions()
1336 if (ce->trait_aliases) { in zend_traits_copy_functions()
1337 alias_ptr = ce->trait_aliases; in zend_traits_copy_functions()
1364 zend_add_trait_method(ce, ZSTR_VAL(fn->common.function_name), fnname, &fn_copy, overriden); in zend_traits_copy_functions()
1371 static uint32_t zend_check_trait_usage(zend_class_entry *ce, zend_class_entry *trait) /* {{{ */ in zend_check_trait_usage() argument
1380 for (i = 0; i < ce->num_traits; i++) { in zend_check_trait_usage()
1381 if (ce->traits[i] == trait) { in zend_check_trait_usage()
1385 …_COMPILE_ERROR, "Required Trait %s wasn't added to %s", ZSTR_VAL(trait->name), ZSTR_VAL(ce->name)); in zend_check_trait_usage()
1390 static void zend_traits_init_trait_structures(zend_class_entry *ce, HashTable ***exclude_tables_ptr… in zend_traits_init_trait_structures() argument
1403 if (ce->trait_precedences) { in zend_traits_init_trait_structures()
1404 exclude_tables = ecalloc(ce->num_traits, sizeof(HashTable*)); in zend_traits_init_trait_structures()
1406 precedences = ce->trait_precedences; in zend_traits_init_trait_structures()
1407 ce->trait_precedences = NULL; in zend_traits_init_trait_structures()
1416 zend_check_trait_usage(ce, trait); in zend_traits_init_trait_structures()
1443 trait_num = zend_check_trait_usage(ce, exclude_ce); in zend_traits_init_trait_structures()
1466 ce->trait_precedences = precedences; in zend_traits_init_trait_structures()
1469 if (ce->trait_aliases) { in zend_traits_init_trait_structures()
1471 while (ce->trait_aliases[i]) { in zend_traits_init_trait_structures()
1476 while (ce->trait_aliases[i]) { in zend_traits_init_trait_structures()
1478 if (ce->trait_aliases[i]->trait_method.class_name) { in zend_traits_init_trait_structures()
1479 cur_method_ref = &ce->trait_aliases[i]->trait_method; in zend_traits_init_trait_structures()
1484 zend_check_trait_usage(ce, trait); in zend_traits_init_trait_structures()
1505 static void zend_do_traits_method_binding(zend_class_entry *ce, HashTable **exclude_tables, zend_cl… in zend_do_traits_method_binding() argument
1513 for (i = 0; i < ce->num_traits; i++) { in zend_do_traits_method_binding()
1515 ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->traits[i]->function_table, key, fn) { in zend_do_traits_method_binding()
1516 zend_traits_copy_functions(key, fn, ce, &overriden, exclude_tables[i], aliases); in zend_do_traits_method_binding()
1526 for (i = 0; i < ce->num_traits; i++) { in zend_do_traits_method_binding()
1527 ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->traits[i]->function_table, key, fn) { in zend_do_traits_method_binding()
1528 zend_traits_copy_functions(key, fn, ce, &overriden, NULL, aliases); in zend_do_traits_method_binding()
1533 ZEND_HASH_FOREACH_PTR(&ce->function_table, fn) { in zend_do_traits_method_binding()
1534 zend_fixup_trait_method(fn, ce); in zend_do_traits_method_binding()
1544 static zend_class_entry* find_first_definition(zend_class_entry *ce, size_t current_trait, zend_str… in find_first_definition() argument
1548 if (coliding_ce == ce) { in find_first_definition()
1550 if (zend_hash_exists(&ce->traits[i]->properties_info, prop_name)) { in find_first_definition()
1551 return ce->traits[i]; in find_first_definition()
1560 static void zend_do_traits_property_binding(zend_class_entry *ce) /* {{{ */ in zend_do_traits_property_binding() argument
1577 for (i = 0; i < ce->num_traits; i++) { in zend_do_traits_property_binding()
1578 ZEND_HASH_FOREACH_PTR(&ce->traits[i]->properties_info, property_info) { in zend_do_traits_property_binding()
1596 if ((coliding_prop = zend_hash_find_ptr(&ce->properties_info, prop_name)) != NULL) { in zend_do_traits_property_binding()
1600 if (coliding_prop->ce == ce->parent) { in zend_do_traits_property_binding()
1606 zend_hash_del(&ce->properties_info, prop_name); in zend_do_traits_property_binding()
1618 op1 = &ce->default_static_members_table[coliding_prop->offset]; in zend_do_traits_property_binding()
1619 op2 = &ce->traits[i]->default_static_members_table[property_info->offset]; in zend_do_traits_property_binding()
1623 op1 = &ce->default_properties_table[OBJ_PROP_TO_NUM(coliding_prop->offset)]; in zend_do_traits_property_binding()
1624 op2 = &ce->traits[i]->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)]; in zend_do_traits_property_binding()
1630 zval_update_constant_ex(&op1_tmp, ce); in zend_do_traits_property_binding()
1635 zval_update_constant_ex(&op2_tmp, ce); in zend_do_traits_property_binding()
1652 ZSTR_VAL(find_first_definition(ce, i, prop_name, coliding_prop->ce)->name), in zend_do_traits_property_binding()
1653 ZSTR_VAL(property_info->ce->name), in zend_do_traits_property_binding()
1655 ZSTR_VAL(ce->name)); in zend_do_traits_property_binding()
1665 prop_value = &ce->traits[i]->default_static_members_table[property_info->offset]; in zend_do_traits_property_binding()
1668 prop_value = &ce->traits[i]->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)]; in zend_do_traits_property_binding()
1673 zend_declare_property_ex(ce, prop_name, in zend_do_traits_property_binding()
1682 static void zend_do_check_for_inconsistent_traits_aliasing(zend_class_entry *ce, zend_class_entry *… in zend_do_check_for_inconsistent_traits_aliasing() argument
1688 if (ce->trait_aliases) { in zend_do_check_for_inconsistent_traits_aliasing()
1689 while (ce->trait_aliases[i]) { in zend_do_check_for_inconsistent_traits_aliasing()
1690 cur_alias = ce->trait_aliases[i]; in zend_do_check_for_inconsistent_traits_aliasing()
1711 if (zend_hash_exists(&ce->function_table, in zend_do_check_for_inconsistent_traits_aliasing()
1732 ZEND_API void zend_do_bind_traits(zend_class_entry *ce) /* {{{ */ in zend_do_bind_traits() argument
1737 if (ce->num_traits == 0) { in zend_do_bind_traits()
1742 zend_traits_init_trait_structures(ce, &exclude_tables, &aliases); in zend_do_bind_traits()
1745 zend_do_traits_method_binding(ce, exclude_tables, aliases); in zend_do_bind_traits()
1748 zend_do_check_for_inconsistent_traits_aliasing(ce, aliases); in zend_do_bind_traits()
1759 zend_do_traits_property_binding(ce); in zend_do_bind_traits()
1762 zend_verify_abstract_class(ce); in zend_do_bind_traits()
1765 zend_check_deprecated_constructor(ce); in zend_do_bind_traits()
1768 if (ce->ce_flags & ZEND_ACC_IMPLICIT_ABSTRACT_CLASS) { in zend_do_bind_traits()
1769 ce->ce_flags -= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS; in zend_do_bind_traits()
1775 static zend_bool zend_has_deprecated_constructor(const zend_class_entry *ce) /* {{{ */ in zend_has_deprecated_constructor() argument
1778 if (!ce->constructor) { in zend_has_deprecated_constructor()
1781 constructor_name = ce->constructor->common.function_name; in zend_has_deprecated_constructor()
1783 ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), in zend_has_deprecated_constructor()
1789 void zend_check_deprecated_constructor(const zend_class_entry *ce) /* {{{ */ in zend_check_deprecated_constructor() argument
1791 if (zend_has_deprecated_constructor(ce)) { in zend_check_deprecated_constructor()
1792 … be constructors in a future version of PHP; %s has a deprecated constructor", ZSTR_VAL(ce->name)); in zend_check_deprecated_constructor()