Skip to content

Commit 2ace877

Browse files
committed
Remove now unused trait inheritance check
zend_add_trait_method() never overrides a parent method, given that parents are not bound yet. Instead, compatibility is checked in do_inherit_method(), as per usual.
1 parent 5faee30 commit 2ace877

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

Zend/zend_inheritance.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2355,7 +2355,6 @@ static void zend_add_trait_method(zend_class_entry *ce, zend_string *name, zend_
23552355
{
23562356
zend_function *existing_fn = NULL;
23572357
zend_function *new_fn;
2358-
bool check_inheritance = false;
23592358

23602359
if ((existing_fn = zend_hash_find_ptr(&ce->function_table, key)) != NULL) {
23612360
/* if it is the same function with the same visibility and has not been assigned a class scope yet, regardless
@@ -2389,8 +2388,6 @@ static void zend_add_trait_method(zend_class_entry *ce, zend_string *name, zend_
23892388
ZSTR_VAL(fn->common.scope->name), ZSTR_VAL(fn->common.function_name),
23902389
ZSTR_VAL(ce->name), ZSTR_VAL(name),
23912390
ZSTR_VAL(existing_fn->common.scope->name), ZSTR_VAL(existing_fn->common.function_name));
2392-
} else {
2393-
check_inheritance = true;
23942391
}
23952392
}
23962393

@@ -2410,19 +2407,6 @@ static void zend_add_trait_method(zend_class_entry *ce, zend_string *name, zend_
24102407
function_add_ref(new_fn);
24112408
fn = zend_hash_update_ptr(&ce->function_table, key, new_fn);
24122409
zend_add_magic_method(ce, fn, key);
2413-
2414-
if (check_inheritance) {
2415-
/* Inherited members are overridden by members inserted by traits.
2416-
* Check whether the trait method fulfills the inheritance requirements. */
2417-
uint32_t flags = ZEND_INHERITANCE_CHECK_PROTO | ZEND_INHERITANCE_CHECK_VISIBILITY;
2418-
if (!(existing_fn->common.scope->ce_flags & ZEND_ACC_TRAIT)) {
2419-
flags |= ZEND_INHERITANCE_SET_CHILD_CHANGED |ZEND_INHERITANCE_SET_CHILD_PROTO |
2420-
ZEND_INHERITANCE_RESET_CHILD_OVERRIDE;
2421-
}
2422-
do_inheritance_check_on_method(
2423-
fn, fixup_trait_scope(fn, ce), existing_fn, fixup_trait_scope(existing_fn, ce),
2424-
ce, NULL, flags);
2425-
}
24262410
}
24272411
/* }}} */
24282412

0 commit comments

Comments
 (0)