Skip to content

Commit 2c4346f

Browse files
committed
Remove unnecessary property unmangling in trait binding
The unmangled name is already available as the hashtable key, use it directly.
1 parent 5da23eb commit 2c4346f

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

Zend/zend_inheritance.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,10 +2008,8 @@ static void zend_do_traits_property_binding(zend_class_entry *ce, zend_class_ent
20082008
zend_property_info *coliding_prop;
20092009
zend_property_info *new_prop;
20102010
zend_string* prop_name;
2011-
const char* class_name_unused;
20122011
bool not_compatible;
20132012
zval* prop_value;
2014-
uint32_t flags;
20152013
zend_string *doc_comment;
20162014

20172015
/* 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
20232021
if (!traits[i]) {
20242022
continue;
20252023
}
2026-
ZEND_HASH_FOREACH_PTR(&traits[i]->properties_info, property_info) {
2027-
/* first get the unmangeld name if necessary,
2028-
* then check whether the property is already there
2029-
*/
2030-
flags = property_info->flags;
2031-
if (flags & ZEND_ACC_PUBLIC) {
2032-
prop_name = zend_string_copy(property_info->name);
2033-
} else {
2034-
const char *pname;
2035-
size_t pname_len;
2036-
2037-
/* for private and protected we need to unmangle the names */
2038-
zend_unmangle_property_name_ex(property_info->name,
2039-
&class_name_unused, &pname, &pname_len);
2040-
prop_name = zend_string_init(pname, pname_len, 0);
2041-
}
2024+
ZEND_HASH_FOREACH_STR_KEY_PTR(&traits[i]->properties_info, prop_name, property_info) {
2025+
uint32_t flags = property_info->flags;
20422026

20432027
/* next: check for conflicts with current class */
20442028
if ((coliding_prop = zend_hash_find_ptr(&ce->properties_info, prop_name)) != NULL) {

0 commit comments

Comments
 (0)