Index: ext/reflection/php_reflection.c =================================================================== RCS file: /repository/php-src/ext/reflection/php_reflection.c,v retrieving revision 1.164.2.33.2.19 diff -u -p -d -r1.164.2.33.2.19 php_reflection.c --- ext/reflection/php_reflection.c 26 Jul 2006 23:18:41 -0000 1.164.2.33.2.19 +++ ext/reflection/php_reflection.c 29 Aug 2006 11:05:28 -0000 @@ -3865,7 +3865,7 @@ ZEND_METHOD(reflection_property, getValu reflection_object *intern; property_reference *ref; zval *object, name; - zval **member= NULL; + zval **member = NULL, *member_p = NULL; METHOD_NOTSTATIC(reflection_property_ptr); GET_REFLECTION_OBJECT_PTR(ref); @@ -3884,19 +3884,22 @@ ZEND_METHOD(reflection_property, getValu zend_error(E_ERROR, "Internal error: Could not find the property %s::%s", intern->ce->name, ref->prop->name); /* Bails out */ } + *return_value= **member; + zval_copy_ctor(return_value); + INIT_PZVAL(return_value); } else { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &object) == FAILURE) { return; } - if (zend_hash_quick_find(Z_OBJPROP_P(object), ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &member) == FAILURE) { - zend_error(E_ERROR, "Internal error: Could not find the property %s::%s", intern->ce->name, ref->prop->name); - /* Bails out */ + member_p = zend_read_property(Z_OBJCE_P(object), object, ref->prop->name, ref->prop->name_length, 1 TSRMLS_CC); + *return_value= *member_p; + zval_copy_ctor(return_value); + INIT_PZVAL(return_value); + if (member_p != EG(uninitialized_zval_ptr)) { + zval_add_ref(&member_p); + zval_ptr_dtor(&member_p); } } - - *return_value= **member; - zval_copy_ctor(return_value); - INIT_PZVAL(return_value); } /* }}} */ @@ -3932,38 +3935,38 @@ ZEND_METHOD(reflection_property, setValu } zend_update_class_constants(intern->ce TSRMLS_CC); prop_table = CE_STATIC_MEMBERS(intern->ce); - } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oz", &object, &value) == FAILURE) { - return; - } - prop_table = Z_OBJPROP_P(object); - } - if (zend_hash_quick_find(prop_table, ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &variable_ptr) == FAILURE) { - zend_error(E_ERROR, "Internal error: Could not find the property %s::%s", intern->ce->name, ref->prop->name); - /* Bails out */ - } - if (*variable_ptr == value) { - setter_done = 1; - } else { - if (PZVAL_IS_REF(*variable_ptr)) { - zval_dtor(*variable_ptr); - (*variable_ptr)->type = value->type; - (*variable_ptr)->value = value->value; - if (value->refcount > 0) { - zval_copy_ctor(*variable_ptr); - } + if (zend_hash_quick_find(prop_table, ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &variable_ptr) == FAILURE) { + zend_error(E_ERROR, "Internal error: Could not find the property %s::%s", intern->ce->name, ref->prop->name); + /* Bails out */ + } + if (*variable_ptr == value) { setter_done = 1; + } else { + if (PZVAL_IS_REF(*variable_ptr)) { + zval_dtor(*variable_ptr); + (*variable_ptr)->type = value->type; + (*variable_ptr)->value = value->value; + if (value->refcount > 0) { + zval_copy_ctor(*variable_ptr); + } + setter_done = 1; + } } - } - if (!setter_done) { - zval **foo; + if (!setter_done) { + zval **foo; - value->refcount++; - if (PZVAL_IS_REF(value)) { - SEPARATE_ZVAL(&value); + value->refcount++; + if (PZVAL_IS_REF(value)) { + SEPARATE_ZVAL(&value); + } + zend_hash_quick_update(prop_table, ref->prop->name, ref->prop->name_length+1, ref->prop->h, &value, sizeof(zval *), (void **) &foo); } - zend_hash_quick_update(prop_table, ref->prop->name, ref->prop->name_length+1, ref->prop->h, &value, sizeof(zval *), (void **) &foo); + } else { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oz", &object, &value) == FAILURE) { + return; + } + zend_update_property(Z_OBJCE_P(object), object, ref->prop->name, ref->prop->name_length, value TSRMLS_CC); } } /* }}} */