From 262f52d5e2dedbc735363ddd3504190447edf3bf Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 3 Mar 2020 15:00:15 +0100 Subject: [PATCH] Small code cleanup I found what the modifier code does with XOR pretty confusing. It's just removing the PPP bits... Also remove an outdated reference to OVERLOADED_FUNCTION. --- Zend/zend_inheritance.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index df84efc389c..f15c325d676 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -1697,7 +1697,7 @@ static void zend_traits_copy_functions(zend_string *fnname, zend_function *fn, z /* if it is 0, no modifieres has been changed */ if (alias->modifiers) { - fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags ^ (fn->common.fn_flags & ZEND_ACC_PPP_MASK)); + fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags & ~ZEND_ACC_PPP_MASK); } lcname = zend_string_tolower(alias->alias); @@ -1712,8 +1712,7 @@ static void zend_traits_copy_functions(zend_string *fnname, zend_function *fn, z if (exclude_table == NULL || zend_hash_find(exclude_table, fnname) == NULL) { /* is not in hashtable, thus, function is not to be excluded */ - /* And how about ZEND_OVERLOADED_FUNCTION? */ - memcpy(&fn_copy, fn, fn->type == ZEND_USER_FUNCTION? sizeof(zend_op_array) : sizeof(zend_internal_function)); + memcpy(&fn_copy, fn, fn->type == ZEND_USER_FUNCTION ? sizeof(zend_op_array) : sizeof(zend_internal_function)); /* apply aliases which have not alias name, just setting visibility */ if (ce->trait_aliases) { @@ -1726,7 +1725,7 @@ static void zend_traits_copy_functions(zend_string *fnname, zend_function *fn, z && fn->common.scope == aliases[i] && zend_string_equals_ci(alias->trait_method.method_name, fnname) ) { - fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags ^ (fn->common.fn_flags & ZEND_ACC_PPP_MASK)); + fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags & ~ZEND_ACC_PPP_MASK); } alias_ptr++; alias = *alias_ptr;