com php-src: Remove dead code related to inherits props in reflection: ext/reflection/php_reflection.c

From: Date: Mon, 04 Nov 2019 10:24:32 +0000
Subject: com php-src: Remove dead code related to inherits props in reflection: ext/reflection/php_reflection.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-109178@lists.php.net to get a copy of this message
Commit: 5b447d4b42416eb5c5ef94cf0b374e5a60ec4f39 Author: Nikita Popov <nikita.ppv@gmail.com> Mon, 4 Nov 2019 11:24:32 +0100 Parents: 0e3045ae69d1b80c21b2779df721a4ad8bcda401 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5b447d4b42416eb5c5ef94cf0b374e5a60ec4f39 Log: 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. Changed paths: M ext/reflection/php_reflection.c Diff: diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 8e8771482cc..5bfbb5f6f9a 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);

« previous php.cvs (#109178) next »