From: Nikita Popov Date: Mon, 4 Nov 2019 10:24:32 +0000 (+0100) Subject: Remove dead code related to inherits props in reflection X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5b447d4b42416eb5c5ef94cf0b374e5a60ec4f39;p=php Remove dead code related to inherits props in reflection Public/protected properties defined in parent classes will be inherited in the child -- there is no need to explicitly try to walk up the chain and look them up. --- diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 8e8771482c..5bfbb5f6f9 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1196,23 +1196,6 @@ static void reflection_property_factory(zend_class_entry *ce, zend_string *name, reflection_object *intern; property_reference *reference; - if (!prop || !(prop->flags & ZEND_ACC_PRIVATE)) { - /* we have to search the class hierarchy for this (implicit) public or protected property */ - zend_class_entry *tmp_ce = ce, *store_ce = ce; - zend_property_info *tmp_info = NULL; - - while (tmp_ce && (tmp_info = zend_hash_find_ptr(&tmp_ce->properties_info, name)) == NULL) { - ce = tmp_ce; - tmp_ce = tmp_ce->parent; - } - - if (tmp_info && (!(tmp_info->flags & ZEND_ACC_PRIVATE) || tmp_info->ce == tmp_ce)) { /* found something and it's not a parent's private */ - prop = tmp_info; - } else { /* not found, use initial value */ - ce = store_ce; - } - } - reflection_instantiate(reflection_property_ptr, object); intern = Z_REFLECTION_P(object); reference = (property_reference*) emalloc(sizeof(property_reference)); @@ -5247,18 +5230,6 @@ ZEND_METHOD(reflection_property, __construct) } } - if (dynam_prop == 0 && (property_info->flags & ZEND_ACC_PRIVATE) == 0) { - /* we have to search the class hierarchy for this (implicit) public or protected property */ - zend_class_entry *tmp_ce = ce; - zend_property_info *tmp_info; - - while (tmp_ce && (tmp_info = zend_hash_find_ptr(&tmp_ce->properties_info, name)) == NULL) { - ce = tmp_ce; - property_info = tmp_info; - tmp_ce = tmp_ce->parent; - } - } - ZVAL_STR_COPY(reflection_prop_name(object), name); if (dynam_prop == 0) { ZVAL_STR_COPY(reflection_prop_class(object), property_info->ce->name);