Skip to content

Commit b773242

Browse files
committed
Extra fixes
1 parent 3a8b3d2 commit b773242

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

Zend/zend_compile.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,9 +1457,8 @@ zend_string *zend_type_to_string_resolved(const zend_type type, zend_class_entry
14571457
str = add_type_string(str, resolved, /* is_intersection */ false);
14581458
zend_string_release(resolved);
14591459
} ZEND_TYPE_LIST_FOREACH_END();
1460-
// TODO Is this still required?
1461-
//} else if (ZEND_TYPE_IS_ASSOCIATED(type)) {
1462-
// str = add_associated_type(ZEND_TYPE_NAME(type), scope);
1460+
} else if (ZEND_TYPE_IS_ASSOCIATED(type)) {
1461+
ZEND_ASSERT(false && "Generic type declarations do not exist yet");
14631462
} else if (ZEND_TYPE_HAS_NAME(type)) {
14641463
str = resolve_class_name(ZEND_TYPE_NAME(type), scope);
14651464
}
@@ -9082,20 +9081,19 @@ static void zend_compile_implements(zend_ast *ast) /* {{{ */
90829081
zend_resolve_const_class_name_reference_with_generics(interface_ast, "interface name");
90839082
interface_names[i].lc_name = zend_string_tolower(interface_names[i].name);
90849083

9085-
// TODO, need the list to a type list
90869084
if (interface_ast->child[1]) {
90879085
const zend_ast_list *generics_list = zend_ast_get_list(interface_ast->child[1]);
90889086
const uint32_t num_generic_args = generics_list->children;
90899087

9090-
// TODO Check that we have the same number of generic args?
9088+
// TODO Can we already check that we have correct number of generic args?
90919089
if (ce->bound_types == NULL) {
90929090
ALLOC_HASHTABLE(ce->bound_types);
9093-
zend_hash_init(ce->bound_types, list->children-i, NULL, zend_bound_types_ht_dtor, false /* todo depend on internal or not */);
9091+
zend_hash_init(ce->bound_types, list->children-i, NULL, zend_bound_types_ht_dtor, false /* todo depend on internal or not? */);
90949092
}
90959093

90969094
HashTable *bound_interface_types;
90979095
ALLOC_HASHTABLE(bound_interface_types);
9098-
zend_hash_init(bound_interface_types, num_generic_args, NULL, zend_types_ht_dtor, false /* todo depend on internal or not */);
9096+
zend_hash_init(bound_interface_types, num_generic_args, NULL, zend_types_ht_dtor, false /* todo depend on internal or not? */);
90999097
for (uint32_t generic_param = 0; generic_param < num_generic_args; ++generic_param) {
91009098
zend_type bound_type = zend_compile_typename(generics_list->child[generic_param]);
91019099
zend_hash_index_add_mem(bound_interface_types, generic_param, &bound_type, sizeof(bound_type));

Zend/zend_opcode.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,6 @@ ZEND_API void destroy_zend_class(zval *zv)
335335

336336
bool persistent = ce->type == ZEND_INTERNAL_CLASS;
337337
/* Common to internal and user classes */
338-
if (ce->attributes) {
339-
zend_hash_release(ce->attributes);
340-
}
341338
if (ce->bound_types) {
342339
zend_hash_release(ce->bound_types);
343340
}
@@ -364,6 +361,10 @@ ZEND_API void destroy_zend_class(zval *zv)
364361
zend_string_release_ex(ce->doc_comment, 0);
365362
}
366363

364+
if (ce->attributes) {
365+
zend_hash_release(ce->attributes);
366+
}
367+
367368
if (ce->num_interfaces > 0 && !(ce->ce_flags & ZEND_ACC_RESOLVED_INTERFACES)) {
368369
uint32_t i;
369370

@@ -537,6 +538,9 @@ ZEND_API void destroy_zend_class(zval *zv)
537538
if (ce->properties_info_table) {
538539
free(ce->properties_info_table);
539540
}
541+
if (ce->attributes) {
542+
zend_hash_release(ce->attributes);
543+
}
540544
free(ce);
541545
break;
542546
}

0 commit comments

Comments
 (0)