]> granicus.if.org Git - php/commitdiff
Remove dead code related to inherits props in reflection
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 4 Nov 2019 10:24:32 +0000 (11:24 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 4 Nov 2019 10:24:32 +0000 (11:24 +0100)
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.

ext/reflection/php_reflection.c

index 8e8771482cc4fcfc1ff56270e054e9d531a2b3d6..5bfbb5f6f9a603b5829da4bdee7146f2763c6365 100644 (file)
@@ -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);