iliaa Thu Jul 27 00:22:07 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: MFB: Improved fix for bug #38132 http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.247&r2=1.248&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.247 php-src/ext/reflection/php_reflection.c:1.248 --- php-src/ext/reflection/php_reflection.c:1.247 Wed Jul 26 08:06:59 2006 +++ php-src/ext/reflection/php_reflection.c Thu Jul 27 00:22:07 2006 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_reflection.c,v 1.247 2006/07/26 08:06:59 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.248 2006/07/27 00:22:07 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2643,9 +2643,10 @@ Returns an associative array containing all static property values of the class */ ZEND_METHOD(reflection_class, getStaticProperties) { - zval *tmp_copy; reflection_object *intern; zend_class_entry *ce; + HashPosition pos; + zval **value; METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0); GET_REFLECTION_OBJECT_PTR(ce); @@ -2653,7 +2654,25 @@ zend_update_class_constants(ce TSRMLS_CC); array_init(return_value); - zend_hash_copy(Z_ARRVAL_P(return_value), CE_STATIC_MEMBERS(ce), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *)); + zend_hash_internal_pointer_reset_ex(CE_STATIC_MEMBERS(ce), &pos); + + while (zend_hash_get_current_data_ex(CE_STATIC_MEMBERS(ce), (void **) &value, &pos) == SUCCESS) { + uint key_len; + zstr key; + ulong num_index; + + if (zend_hash_get_current_key_ex(CE_STATIC_MEMBERS(ce), &key, &key_len, &num_index, 0, &pos) != FAILURE) { + zstr prop_name, class_name; + int prop_name_len = UG(unicode) ? u_strlen(prop_name.u) : strlen(prop_name.s); + + zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, key, key_len-1, &class_name, &prop_name); + + zval_add_ref(value); + + zend_u_hash_update(Z_ARRVAL_P(return_value), UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len, value, sizeof(zval *), NULL); + } + zend_hash_move_forward_ex(CE_STATIC_MEMBERS(ce), &pos); + } } /* }}} */ @@ -4845,7 +4864,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.247 2006/07/26 08:06:59 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.248 2006/07/27 00:22:07 iliaa Exp $"); php_info_print_table_end(); } /* }}} */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php