From: Antony Dovgal Date: Fri, 6 Oct 2006 18:02:50 +0000 (+0000) Subject: more improvements X-Git-Tag: RELEASE_1_0_0RC1~1383 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5d4259ff85bf2bcc2186e457b2744ed3a2360fc2;p=php more improvements --- diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index b3e97c6908..26de54bbbf 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -4099,12 +4099,12 @@ ZEND_METHOD(reflection_property, getDeclaringClass) prop_name_len = USTR_LEN(prop_name); ce = tmp_ce = ref->ce; while (tmp_ce && zend_u_hash_find(&tmp_ce->properties_info, UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len + 1, (void **) &tmp_info) == SUCCESS) { - ce = tmp_ce; - tmp_ce = tmp_ce->parent; if (tmp_info->flags & ZEND_ACC_PRIVATE) { /* it's a private property, so it can't be inherited */ break; } + ce = tmp_ce; + tmp_ce = tmp_ce->parent; } zend_reflection_class_factory(ce, return_value TSRMLS_CC); diff --git a/ext/reflection/tests/bug39067.phpt b/ext/reflection/tests/bug39067.phpt index c225dc4954..71e859a2c7 100644 --- a/ext/reflection/tests/bug39067.phpt +++ b/ext/reflection/tests/bug39067.phpt @@ -24,15 +24,28 @@ var_dump($rc->getProperty('x')->getDeclaringClass()->getName()); $rc = new ReflectionClass('A'); var_dump($rc->getProperty('x')->getDeclaringClass()->getName()); +class Test { + private $x; +} + +class Test2 extends Test { + public $x; +} + +$rc = new ReflectionClass('Test2'); +var_dump($rc->getProperty('x')->getDeclaringClass()->getName()); + echo "Done\n"; ?> --EXPECTF-- string(1) "C" string(1) "B" string(1) "A" +string(5) "Test2" Done --UEXPECTF-- unicode(1) "C" unicode(1) "B" unicode(1) "A" +unicode(4) "Test2" Done