diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-01-21 15:20:12 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-01-21 15:21:07 +0100 |
commit | 1f1a7ecaf2acece96601bf1dcacfbb9c01884bbe (patch) | |
tree | 7c98da3fe10bdde194d4673a2e576b12ef8e1a35 /ext/reflection/php_reflection.c | |
parent | 13178087c7eaa092667ec3b713e26cba1b919969 (diff) | |
download | php-git-1f1a7ecaf2acece96601bf1dcacfbb9c01884bbe.tar.gz |
Simplify ReflectionProperty::getDeclaringClass()
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r-- | ext/reflection/php_reflection.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index a3cd824fdd..d53862fba7 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -5601,28 +5601,14 @@ ZEND_METHOD(reflection_property, getDeclaringClass) { reflection_object *intern; property_reference *ref; - zend_class_entry *tmp_ce, *ce; - zend_property_info *tmp_info; + zend_class_entry *ce; if (zend_parse_parameters_none() == FAILURE) { RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ref); - ce = tmp_ce = intern->ce; - while (tmp_ce && (tmp_info = zend_hash_find_ptr(&tmp_ce->properties_info, ref->unmangled_name)) != NULL) { - if (tmp_info->flags & ZEND_ACC_PRIVATE) { - /* it's a private property, so it can't be inherited */ - break; - } - ce = tmp_ce; - if (tmp_ce == tmp_info->ce) { - /* declared in this class, done */ - break; - } - tmp_ce = tmp_ce->parent; - } - + ce = ref->prop ? ref->prop->ce : intern->ce; zend_reflection_class_factory(ce, return_value); } /* }}} */ |