diff options
author | Marcus Boerger <helly@php.net> | 2004-02-26 01:06:18 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2004-02-26 01:06:18 +0000 |
commit | 3e1f3b2124a6ef21e32f73ae2c52c346cddab04d (patch) | |
tree | 2e39e2d7952e23e1ee2ba879c4087ff101b0a9e8 /ext/reflection/php_reflection.c | |
parent | 639073bd2ae62d8f88425dc4cfb1d956e209a30d (diff) | |
download | php-git-3e1f3b2124a6ef21e32f73ae2c52c346cddab04d.tar.gz |
Fix problem with Reflection_Property (patch from Timm slightly modified).
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r-- | ext/reflection/php_reflection.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 3bc7112b8b..0d4dd48eb9 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -771,7 +771,11 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info zend_class_entry *tmp_ce = ce->parent; zend_property_info *tmp_info; - while (tmp_ce && zend_hash_find(&ce->properties_info, prop_name, strlen(prop_name) + 1, (void **) &tmp_info) == SUCCESS) { + while (tmp_ce && zend_hash_find(&tmp_ce->properties_info, prop_name, strlen(prop_name) + 1, (void **) &tmp_info) == SUCCESS) { + if (tmp_info->flags & ZEND_ACC_PRIVATE) { + /* private in super class => NOT the same property */ + break; + } ce = tmp_ce; prop = tmp_info; tmp_ce = tmp_ce->parent; @@ -2564,20 +2568,25 @@ ZEND_METHOD(reflection_property, __construct) "Property %s::$%s does not exist", ce->name, name_str); return; } - free_alloca(lcname); if (!(property_info->flags & ZEND_ACC_PRIVATE)) { /* we have to seach the class hierarchy for this (implicit) public or protected property */ zend_class_entry *tmp_ce = ce->parent; zend_property_info *tmp_info; - while (tmp_ce && zend_hash_find(&ce->properties_info, name_str, name_len + 1, (void **) &tmp_info) == SUCCESS) { + while (tmp_ce && zend_hash_find(&tmp_ce->properties_info, lcname, name_len + 1, (void **) &tmp_info) == SUCCESS) { + if (tmp_info->flags & ZEND_ACC_PRIVATE) { + /* private in super class => NOT the same property */ + break; + } ce = tmp_ce; property_info = tmp_info; tmp_ce = tmp_ce->parent; } } + free_alloca(lcname); + MAKE_STD_ZVAL(classname); ZVAL_STRINGL(classname, ce->name, ce->name_length, 1); zend_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL); |