diff options
author | Kalle Sommer Nielsen <kalle@php.net> | 2009-07-01 18:44:56 +0000 |
---|---|---|
committer | Kalle Sommer Nielsen <kalle@php.net> | 2009-07-01 18:44:56 +0000 |
commit | 485f28aae9f49e41363ea507b9e5c7dadf2eb0a0 (patch) | |
tree | 8f5f4ecd8fe6665301738dea533805158ba7532d /ext/reflection/php_reflection.c | |
parent | e536b2700ac604239aee33989621e0f3d89c8723 (diff) | |
download | php-git-485f28aae9f49e41363ea507b9e5c7dadf2eb0a0.tar.gz |
MFH: Fixed #45280 (Reflection of instantiated COM classes causes PHP to crash) (Paul Richards, Kalle)
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r-- | ext/reflection/php_reflection.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index e1a941991e..d3cd28e8e0 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -533,23 +533,25 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in string_init(&dyn); count = 0; - zend_hash_internal_pointer_reset_ex(properties, &pos); - - while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) { - char *prop_name; - uint prop_name_size; - ulong index; - - if (zend_hash_get_current_key_ex(properties, &prop_name, &prop_name_size, &index, 1, &pos) == HASH_KEY_IS_STRING) { - if (prop_name_size && prop_name[0]) { /* skip all private and protected properties */ - if (!zend_hash_quick_exists(&ce->properties_info, prop_name, prop_name_size, zend_get_hash_value(prop_name, prop_name_size))) { - count++; - _property_string(&dyn, NULL, prop_name, sub_indent.string TSRMLS_CC); + if (properties && zend_hash_num_elements(properties)) { + zend_hash_internal_pointer_reset_ex(properties, &pos); + + while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) { + char *prop_name; + uint prop_name_size; + ulong index; + + if (zend_hash_get_current_key_ex(properties, &prop_name, &prop_name_size, &index, 1, &pos) == HASH_KEY_IS_STRING) { + if (prop_name_size && prop_name[0]) { /* skip all private and protected properties */ + if (!zend_hash_quick_exists(&ce->properties_info, prop_name, prop_name_size, zend_get_hash_value(prop_name, prop_name_size))) { + count++; + _property_string(&dyn, NULL, prop_name, sub_indent.string TSRMLS_CC); + } } + efree(prop_name); } - efree(prop_name); + zend_hash_move_forward_ex(properties, &pos); } - zend_hash_move_forward_ex(properties, &pos); } string_printf(str, "\n%s - Dynamic properties [%d] {\n", indent, count); |