kalle Wed Jul 1 18:44:16 2009 UTC Added files: /php-src/ext/com_dotnet/tests bug45280.phpt
Modified files: /php-src/ext/reflection php_reflection.c Log: Fixed #45280 (Reflection of instantiated COM classes causes PHP to crash) (Paul Richards, Kalle) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.348&r2=1.349&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.348 php-src/ext/reflection/php_reflection.c:1.349 --- php-src/ext/reflection/php_reflection.c:1.348 Wed Jul 1 17:42:48 2009 +++ php-src/ext/reflection/php_reflection.c Wed Jul 1 18:44:16 2009 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_reflection.c,v 1.348 2009/07/01 17:42:48 kalle Exp $ */ +/* $Id: php_reflection.c,v 1.349 2009/07/01 18:44:16 kalle Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -531,23 +531,25 @@ string_init(&dyn); count = 0; - zend_hash_internal_pointer_reset_ex(properties, &pos); + 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) { - zstr prop_name; - uint prop_name_size; - zend_uchar prop_type; - ulong index; - - if ((prop_type = zend_hash_get_current_key_ex(properties, &prop_name, &prop_name_size, &index, 0, &pos)) == HASH_KEY_IS_UNICODE) { - if (prop_name_size && prop_name.u[0]) { /* skip all private and protected properties */ - if (!zend_u_hash_exists(&ce->properties_info, prop_type, prop_name, prop_name_size)) { - count++; - _property_string(&dyn, NULL, prop_name, sub_indent.string TSRMLS_CC); + while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) { + zstr prop_name; + uint prop_name_size; + zend_uchar prop_type; + ulong index; + + if ((prop_type = zend_hash_get_current_key_ex(properties, &prop_name, &prop_name_size, &index, 0, &pos)) == HASH_KEY_IS_UNICODE) { + if (prop_name_size && prop_name.u[0]) { /* skip all private and protected properties */ + if (!zend_u_hash_exists(&ce->properties_info, prop_type, prop_name, prop_name_size)) { + count++; + _property_string(&dyn, NULL, prop_name, sub_indent.string TSRMLS_CC); + } } } + 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); @@ -5689,7 +5691,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Revision: 1.348 $"); + php_info_print_table_row(2, "Version", "$Revision: 1.349 $"); php_info_print_table_end(); } /* }}} */ @@ -5703,7 +5705,7 @@ NULL, NULL, PHP_MINFO(reflection), - "$Revision: 1.348 $", + "$Revision: 1.349 $", STANDARD_MODULE_PROPERTIES }; /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/com_dotnet/tests/bug45280.phpt?view=markup&rev=1.1 Index: php-src/ext/com_dotnet/tests/bug45280.phpt +++ php-src/ext/com_dotnet/tests/bug45280.phpt --TEST-- Bug #45280 (Reflection of instantiated COM classes causes PHP to crash) --SKIPIF-- <?php if (!extension_loaded("reflection")){ echo "skip, no reflection support present"; } if (!extension_loaded("com_dotnet")){ echo "skip COM/.Net support not present"; } ?> --FILE-- <?php $dict = new COM("Scripting.Dictionary"); ob_start(); ReflectionObject::export($dict); ob_get_clean(); echo 'done'; ?> --EXPECT-- done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php