cvs: ZendEngine2 / zend_reflection_api.c

From: Date: Fri, 05 Sep 2003 14:48:55 +0000
Subject: cvs: ZendEngine2 / zend_reflection_api.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-1813@lists.php.net to get a copy of this message
helly Fri Sep 5 10:48:55 2003 EDT Modified files: /ZendEngine2 zend_reflection_api.c Log: Simplify reflection_property::__constructor() and fix property factory Index: ZendEngine2/zend_reflection_api.c diff -u ZendEngine2/zend_reflection_api.c:1.58 ZendEngine2/zend_reflection_api.c:1.59 --- ZendEngine2/zend_reflection_api.c:1.58 Fri Sep 5 10:35:31 2003 +++ ZendEngine2/zend_reflection_api.c Fri Sep 5 10:48:55 2003 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_reflection_api.c,v 1.58 2003/09/05 14:35:31 helly Exp $ */ +/* $Id: zend_reflection_api.c,v 1.59 2003/09/05 14:48:55 helly Exp $ */ #include "zend.h" #include "zend_API.h" #include "zend_default_classes.h" @@ -660,11 +660,24 @@ unmangle_property_name(prop->name, &class_name, &prop_name); + if (!(prop->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, prop_name, strlen(prop_name) + 1, (void **) &tmp_info) == SUCCESS) { + ce = tmp_ce; + prop = tmp_info; + tmp_ce = tmp_ce->parent; + } + } + MAKE_STD_ZVAL(name); ZVAL_STRING(name, prop_name, 1); MAKE_STD_ZVAL(classname); ZVAL_STRINGL(classname, ce->name, ce->name_length, 1); + reflection_instanciate(reflection_property_ptr, object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); reference = (property_reference*) emalloc(sizeof(property_reference)); @@ -2268,21 +2281,7 @@ return; } - if (property_info->flags & ZEND_ACC_PRIVATE) { - char *class_name, *prop_name; - - unmangle_property_name(property_info->name, &class_name, &prop_name); - if (strcmp(lcname, class_name)) { - /* this shouldn't happen */ - if (zend_hash_find(EG(class_table), class_name, strlen(class_name) + 1, (void **) &pce) == FAILURE) { - efree(lcname); - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, - "Class %s does not exist", class_name); - return; - } - ce = *pce; - } - } else { + 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;

« previous php.zend-engine.cvs (#1813) next »