[xdebug-dev] xdebug xdebug/xdebug_var.c - fix crashes on win32 if introspecting com objects. unfortunately, no easy way to deal with this, so we punt just like print_r and family

From: Shane Caraveo <shane[@]caraveo.com>
Date: Tue, 1 Feb 2005 02:28:40 +0100

Date: Tue Feb 1 02:28:39 CET 2005
User: Shane Caraveo
Directory: xdebug

Log Message:
[1.0]
- fix crashes on win32 if introspecting com objects. unfortunately, no easy way to deal with this, so we punt just like print_r and family

Modified files:
           xdebug/xdebug_var.c (version: 1.57)

[FILE: /xdebug/xdebug_var.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- xdebug/xdebug_var.c:1.56 Sun Jan 30 22:24:34 2005 GMT
+++ xdebug/xdebug_var.c Tue Feb 01 00:28:39 2005 GMT
@@ -466,6 +466,10 @@
 void xdebug_var_export_xml_node(zval **struc, char *name, xdebug_xml_node *node, int level TSRMLS_DC)
 {
         HashTable *myht;
+#ifdef ZEND_ENGINE_2
+ char *class_name;
+ zend_uint class_name_len;
+#endif
 
         switch (Z_TYPE_PP(struc)) {
                 case IS_BOOL:
@@ -507,13 +511,21 @@
                 case IS_OBJECT:
                         myht = Z_OBJPROP_PP(struc);
                         xdebug_xml_add_attribute(node, "type", "object");
- xdebug_xml_add_attribute(node, "children", myht->nNumOfElements > 0?"1":"0");
+ xdebug_xml_add_attribute(node, "children", (myht && zend_hash_num_elements(myht))?"1":"0");
+#ifdef ZEND_ENGINE_2
+ Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC);
+ xdebug_xml_add_attribute_ex(node, "classname", xdstrdup(class_name), 0, 1);
+ efree(class_name);
+#else
                         xdebug_xml_add_attribute_ex(node, "classname", xdstrdup(Z_OBJCE_PP(struc)->name), 0, 1);
- if (myht->nApplyCount < 1) {
- xdebug_xml_add_attribute_ex(node, "numchildren", xdebug_sprintf("%d", myht->nNumOfElements), 0, 1);
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_object_element_export_xml_node, 3, level, node, name);
- } else {
- xdebug_xml_add_attribute(node, "recursive", "1");
+#endif
+ if (myht) {
+ if (myht->nApplyCount < 1) {
+ xdebug_xml_add_attribute_ex(node, "numchildren", xdebug_sprintf("%d", zend_hash_num_elements(myht)), 0, 1);
+ zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_object_element_export_xml_node, 3, level, node, name);
+ } else {
+ xdebug_xml_add_attribute(node, "recursive", "1");
+ }
                         }
                         break;
 
Received on Tue Feb 01 2005 - 02:28:46 GMT

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST