diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-03-26 12:14:32 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-03-26 12:14:32 +0100 |
commit | 2c4346f9deaca4604fea4783fabc894af352f35b (patch) | |
tree | 16fa4a5dbba5a1cdba103914020a7a259b4428a9 /Zend | |
parent | 5da23eb46c5b7d2840ac775b2b42bc4dd1bbbaae (diff) | |
download | php-git-2c4346f9deaca4604fea4783fabc894af352f35b.tar.gz |
Remove unnecessary property unmangling in trait binding
The unmangled name is already available as the hashtable key,
use it directly.
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/zend_inheritance.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index a78a0bd4f7..28b2834ed6 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -2008,10 +2008,8 @@ static void zend_do_traits_property_binding(zend_class_entry *ce, zend_class_ent zend_property_info *coliding_prop; zend_property_info *new_prop; zend_string* prop_name; - const char* class_name_unused; bool not_compatible; zval* prop_value; - uint32_t flags; zend_string *doc_comment; /* In the following steps the properties are inserted into the property table @@ -2023,22 +2021,8 @@ static void zend_do_traits_property_binding(zend_class_entry *ce, zend_class_ent if (!traits[i]) { continue; } - ZEND_HASH_FOREACH_PTR(&traits[i]->properties_info, property_info) { - /* first get the unmangeld name if necessary, - * then check whether the property is already there - */ - flags = property_info->flags; - if (flags & ZEND_ACC_PUBLIC) { - prop_name = zend_string_copy(property_info->name); - } else { - const char *pname; - size_t pname_len; - - /* for private and protected we need to unmangle the names */ - zend_unmangle_property_name_ex(property_info->name, - &class_name_unused, &pname, &pname_len); - prop_name = zend_string_init(pname, pname_len, 0); - } + ZEND_HASH_FOREACH_STR_KEY_PTR(&traits[i]->properties_info, prop_name, property_info) { + uint32_t flags = property_info->flags; /* next: check for conflicts with current class */ if ((coliding_prop = zend_hash_find_ptr(&ce->properties_info, prop_name)) != NULL) { |