kalle Wed Jul 1 18:44:56 2009 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/com_dotnet/tests bug45280.phpt
Modified files:
/php-src/ext/reflection php_reflection.c
Log:
MFH: 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.164.2.33.2.45.2.60&r2=1.164.2.33.2.45.2.61&diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.60
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.61
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.60 Wed Jul
1 17:43:16 2009
+++ php-src/ext/reflection/php_reflection.c Wed Jul 1 18:44:56 2009
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.60 2009/07/01 17:43:16 kalle Exp
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.61 2009/07/01 18:44:56 kalle Exp
$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -533,23 +533,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) {
- 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);
+ 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);
@@ -5444,7 +5446,7 @@
php_info_print_table_start();
php_info_print_table_header(2, "Reflection", "enabled");
- php_info_print_table_row(2, "Version", "$Revision: 1.164.2.33.2.45.2.60
$");
+ php_info_print_table_row(2, "Version", "$Revision: 1.164.2.33.2.45.2.61
$");
php_info_print_table_end();
} /* }}} */
@@ -5458,7 +5460,7 @@
NULL,
NULL,
PHP_MINFO(reflection),
- "$Revision: 1.164.2.33.2.45.2.60 $",
+ "$Revision: 1.164.2.33.2.45.2.61 $",
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