diff options
author | Antony Dovgal <tony2001@php.net> | 2007-07-11 22:06:54 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2007-07-11 22:06:54 +0000 |
commit | d3ac98438591d27ad83828b73fa7cd295660a7b7 (patch) | |
tree | 3c98de61e4c31c1eff58a104ac2810adadfc514c /ext/reflection/php_reflection.c | |
parent | 0261432888011a5df27fe8e1911aa23d48e00043 (diff) | |
download | php-git-d3ac98438591d27ad83828b73fa7cd295660a7b7.tar.gz |
MFH
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r-- | ext/reflection/php_reflection.c | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 02f8db1144..499a43d52d 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2804,7 +2804,8 @@ ZEND_METHOD(reflection_class, getDefaultProperties) { reflection_object *intern; zend_class_entry *ce; - int count; + int count, i; + HashTable *ht_list[3]; METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0); GET_REFLECTION_OBJECT_PTR(ce); @@ -2812,33 +2813,40 @@ ZEND_METHOD(reflection_class, getDefaultProperties) zend_update_class_constants(ce TSRMLS_CC); - count = zend_hash_num_elements(&ce->default_properties); - if (count > 0) { - HashPosition pos; - zval **prop; + ht_list[0] = CE_STATIC_MEMBERS(ce); + ht_list[1] = &ce->default_properties; + ht_list[2] = NULL; - zend_hash_internal_pointer_reset_ex(&ce->default_properties, &pos); - while (zend_hash_get_current_data_ex(&ce->default_properties, (void **) &prop, &pos) == SUCCESS) { - char *key, *class_name, *prop_name; - uint key_len; - ulong num_index; - zval *prop_copy; + for (i = 0; ht_list[i] != NULL; i++) { - zend_hash_get_current_key_ex(&ce->default_properties, &key, &key_len, &num_index, 0, &pos); - zend_hash_move_forward_ex(&ce->default_properties, &pos); - zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name); - if (class_name && class_name[0] != '*' && strcmp(class_name, ce->name)) { - /* filter privates from base classes */ - continue; - } + count = zend_hash_num_elements(ht_list[i]); + if (count > 0) { + HashPosition pos; + zval **prop; + + zend_hash_internal_pointer_reset_ex(ht_list[i], &pos); + while (zend_hash_get_current_data_ex(ht_list[i], (void **) &prop, &pos) == SUCCESS) { + char *key, *class_name, *prop_name; + uint key_len; + ulong num_index; + zval *prop_copy; + + zend_hash_get_current_key_ex(ht_list[i], &key, &key_len, &num_index, 0, &pos); + zend_hash_move_forward_ex(ht_list[i], &pos); + zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name); + if (class_name && class_name[0] != '*' && strcmp(class_name, ce->name)) { + /* filter privates from base classes */ + continue; + } - /* copy: enforce read only access */ - ALLOC_ZVAL(prop_copy); - *prop_copy = **prop; - zval_copy_ctor(prop_copy); - INIT_PZVAL(prop_copy); + /* copy: enforce read only access */ + ALLOC_ZVAL(prop_copy); + *prop_copy = **prop; + zval_copy_ctor(prop_copy); + INIT_PZVAL(prop_copy); - add_assoc_zval(return_value, prop_name, prop_copy); + add_assoc_zval(return_value, prop_name, prop_copy); + } } } } |