[xdebug-dev] xdebug xdebug/xdebug_code_coverage.c xdebug/xdebug_compat.h xdebug/xdebug_superglobals.c xdebug/xdebug_var.c - Fixed TSRM issues for PHP 5.2 and PHP 5.3. (Original patch by Elizabeth M.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Sat, 28 Mar 2009 16:58:13 +0100

Date: Sat Mar 28 16:58:12 CET 2009
User: Derick Rethans
Directory: xdebug

Log Message:
[1.00]
- Fixed TSRM issues for PHP 5.2 and PHP 5.3. (Original patch by Elizabeth M.
  Smith).

Modified files:
           xdebug/xdebug_code_coverage.c (version: 1.48)
           xdebug/xdebug_compat.h (version: 1.10)
           xdebug/xdebug_superglobals.c (version: 1.28)
           xdebug/xdebug_var.c (version: 1.93)

[FILE: /xdebug/xdebug_code_coverage.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- xdebug/xdebug_code_coverage.c:1.47 Sat Jan 24 19:00:12 2009 GMT
+++ xdebug/xdebug_code_coverage.c Sat Mar 28 14:58:12 2009 GMT
@@ -21,6 +21,7 @@
 #include "xdebug_set.h"
 #include "xdebug_var.h"
 #include "xdebug_code_coverage.h"
+#include "xdebug_compat.h"
 
 extern ZEND_DECLARE_MODULE_GLOBALS(xdebug);
 
@@ -252,10 +253,12 @@
         }
 }
 
-static int prefill_from_function_table(zend_op_array *opa, int num_args, va_list args, zend_hash_key *hash_key)
+static int prefill_from_function_table(zend_op_array *opa XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 {
         char *new_filename;
+#if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300
         TSRMLS_FETCH();
+#endif
 
         new_filename = va_arg(args, char*);
         if (opa->type == ZEND_USER_FUNCTION) {
@@ -267,7 +270,7 @@
         return ZEND_HASH_APPLY_KEEP;
 }
 
-static int prefill_from_class_table(zend_class_entry **class_entry, int num_args, va_list args, zend_hash_key *hash_key)
+static int prefill_from_class_table(zend_class_entry **class_entry XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 {
         char *new_filename;
         zend_class_entry *ce;
@@ -278,7 +281,7 @@
         if (ce->type == ZEND_USER_CLASS) {
                 if (!(ce->ce_flags & ZEND_XDEBUG_VISITED)) {
                         ce->ce_flags |= ZEND_XDEBUG_VISITED;
- zend_hash_apply_with_arguments(&ce->function_table, (apply_func_args_t) prefill_from_function_table, 1, new_filename);
+ zend_hash_apply_with_arguments(&ce->function_table XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) prefill_from_function_table, 1, new_filename);
                 }
         }
 
@@ -291,8 +294,8 @@
                 prefill_from_oparray(op_array->filename, op_array TSRMLS_CC);
         }
 
- zend_hash_apply_with_arguments(CG(function_table), (apply_func_args_t) prefill_from_function_table, 1, op_array->filename);
- zend_hash_apply_with_arguments(CG(class_table), (apply_func_args_t) prefill_from_class_table, 1, op_array->filename);
+ zend_hash_apply_with_arguments(CG(function_table) XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) prefill_from_function_table, 1, op_array->filename);
+ zend_hash_apply_with_arguments(CG(class_table) XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) prefill_from_class_table, 1, op_array->filename);
 }
 
 PHP_FUNCTION(xdebug_start_code_coverage)

[FILE: /xdebug/xdebug_compat.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- xdebug/xdebug_compat.h:1.9 Mon Jan 05 16:24:34 2009 GMT
+++ xdebug/xdebug_compat.h Sat Mar 28 14:58:12 2009 GMT
@@ -47,4 +47,12 @@
 # define XDEBUG_IS_REF is_ref
 #endif
 
+#if defined(PHP_VERSION_ID) && PHP_VERSION_ID >= 50300 && ZTS
+# define XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC TSRMLS_DC
+# define XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC TSRMLS_CC
+#else
+# define XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC
+# define XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC
+#endif
+
 #endif

[FILE: /xdebug/xdebug_superglobals.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- xdebug/xdebug_superglobals.c:1.27 Sun Dec 07 18:28:07 2008 GMT
+++ xdebug/xdebug_superglobals.c Sat Mar 28 14:58:12 2009 GMT
@@ -19,6 +19,7 @@
 #include "php_xdebug.h"
 #include "xdebug_private.h"
 #include "xdebug_var.h"
+#include "xdebug_compat.h"
 #include "xdebug_superglobals.h"
 #include "SAPI.h"
 
@@ -76,12 +77,12 @@
         }
 }
 
-static int dump_hash_elem_va(void *pDest, int num_args, va_list args, zend_hash_key *hash_key)
+static int dump_hash_elem_va(void *pDest XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 {
         int html;
         char *name;
         xdebug_str *str;
-#ifdef ZTS
+#if defined(ZTS) && (!defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300)
         void ***tsrm_ls;
 #endif
 
@@ -89,7 +90,7 @@
         html = va_arg(args, int);
         str = va_arg(args, xdebug_str *);
 
-#ifdef ZTS
+#if defined(ZTS) && (!defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300)
         tsrm_ls = va_arg(args, void ***);
 #endif
 
@@ -133,13 +134,11 @@
         while (elem != NULL) {
                 if (ht && (*((char *) (elem->ptr)) == '*')) {
 
-#ifdef ZTS
-#define X_DUMP_ARGS 4
+#if defined(ZTS) && (!defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300)
+ zend_hash_apply_with_arguments(ht, dump_hash_elem_va, 4, name, html, str TSRMLS_CC);
 #else
-#define X_DUMP_ARGS 3
+ zend_hash_apply_with_arguments(ht TSRMLS_CC, dump_hash_elem_va, 3, name, html, str);
 #endif
-
- zend_hash_apply_with_arguments(ht, dump_hash_elem_va, X_DUMP_ARGS, name, html, str TSRMLS_CC);
                 } else if (ht && zend_hash_find(ht, elem->ptr, strlen(elem->ptr) + 1, (void **) &z) == SUCCESS) {
                         dump_hash_elem(*z, name, 0, elem->ptr, html, str TSRMLS_CC);
                 } else if(XG(dump_undefined)) {

[FILE: /xdebug/xdebug_var.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -r1.92 -r1.93
--- xdebug/xdebug_var.c:1.92 Mon Jan 05 16:24:34 2009 GMT
+++ xdebug/xdebug_var.c Sat Mar 28 14:58:12 2009 GMT
@@ -166,12 +166,14 @@
 ** Normal variable printing routines
 */
 
-static int xdebug_array_element_export(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
+static int xdebug_array_element_export(zval **zv XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 {
         int level, debug_zval;
         xdebug_str *str;
         xdebug_var_export_options *options;
+#if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300
         TSRMLS_FETCH();
+#endif
 
         level = va_arg(args, int);
         str = va_arg(args, struct xdebug_str*);
@@ -209,13 +211,15 @@
         return 0;
 }
 
-static int xdebug_object_element_export(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
+static int xdebug_object_element_export(zval **zv XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 {
         int level, debug_zval;
         xdebug_str *str;
         xdebug_var_export_options *options;
         char *prop_name, *modifier;
+#if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300
         TSRMLS_FETCH();
+#endif
 
         level = va_arg(args, int);
         str = va_arg(args, struct xdebug_str*);
@@ -289,7 +293,7 @@
                                         options->runtime[level].start_element_nr = 0;
                                         options->runtime[level].end_element_nr = options->max_children;
 
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_array_element_export, 4, level, str, debug_zval, options);
+ zend_hash_apply_with_arguments(myht XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_array_element_export, 4, level, str, debug_zval, options);
                                         /* Remove the ", " at the end of the string */
                                         if (myht->nNumOfElements > 0) {
                                                 xdebug_str_chop(str, 2);
@@ -312,7 +316,7 @@
                                         options->runtime[level].start_element_nr = 0;
                                         options->runtime[level].end_element_nr = options->max_children;
 
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_object_element_export, 4, level, str, debug_zval, options);
+ zend_hash_apply_with_arguments(myht XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_object_element_export, 4, level, str, debug_zval, options);
                                         /* Remove the ", " at the end of the string */
                                         if (myht->nNumOfElements > 0) {
                                                 xdebug_str_chop(str, 2);
@@ -434,11 +438,13 @@
 ** XML variable printing routines
 */
 
-static int xdebug_array_element_export_xml(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
+static int xdebug_array_element_export_xml(zval **zv XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 {
         int level;
         xdebug_str *str;
+#if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300
         TSRMLS_FETCH();
+#endif
 
         level = va_arg(args, int);
         str = va_arg(args, struct xdebug_str*);
@@ -455,12 +461,14 @@
         return 0;
 }
 
-static int xdebug_object_element_export_xml(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
+static int xdebug_object_element_export_xml(zval **zv TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 {
         int level;
         xdebug_str *str;
         char *prop_name, *modifier;
+#if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300
         TSRMLS_FETCH();
+#endif
 
         level = va_arg(args, int);
         str = va_arg(args, struct xdebug_str*);
@@ -516,7 +524,7 @@
                         myht = Z_ARRVAL_PP(struc);
                         if (myht->nApplyCount < 1) {
                                 xdebug_str_addl(str, "<array>", 7, 0);
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_array_element_export_xml, 2, level, str);
+ zend_hash_apply_with_arguments(myht XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_array_element_export_xml, 2, level, str);
                                 xdebug_str_addl(str, "</array>", 8, 0);
                         } else {
                                 xdebug_str_addl(str, "<array hidden='true' recursive='true'/>", 39, 0);
@@ -527,7 +535,7 @@
                         myht = Z_OBJPROP_PP(struc);
                         if (myht->nApplyCount < 1) {
                                 xdebug_str_add(str, xdebug_sprintf("<object class='%s'>", Z_OBJCE_PP(struc)->name), 1);
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_object_element_export_xml, 2, level, str);
+ zend_hash_apply_with_arguments(myht XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_object_element_export_xml, 2, level, str);
                                 xdebug_str_addl(str, "</object>", 9, 0);
                         } else {
                                 xdebug_str_addl(str, "<object hidden='true' recursive='true'/>", 40, 0);
@@ -572,14 +580,16 @@
 ** XML node printing routines
 */
 
-static int xdebug_array_element_export_xml_node(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
+static int xdebug_array_element_export_xml_node(zval **zv XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 {
         int level;
         xdebug_xml_node *parent;
         xdebug_xml_node *node;
         xdebug_var_export_options *options;
         char *name = NULL, *parent_name = NULL, *full_name = NULL;
+#if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300
         TSRMLS_FETCH();
+#endif
 
         level = va_arg(args, int);
         parent = va_arg(args, xdebug_xml_node*);
@@ -624,7 +634,7 @@
         return 0;
 }
 
-static int xdebug_object_element_export_xml_node(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
+static int xdebug_object_element_export_xml_node(zval **zv XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 {
         int level;
         xdebug_xml_node *parent;
@@ -632,7 +642,9 @@
         xdebug_var_export_options *options;
         char *prop_name, *modifier;
         char *parent_name = NULL, *full_name = NULL;
+#if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300
         TSRMLS_FETCH();
+#endif
 
         level = va_arg(args, int);
         parent = va_arg(args, xdebug_xml_node*);
@@ -721,7 +733,7 @@
                                                 options->runtime[level].start_element_nr = 0;
                                                 options->runtime[level].end_element_nr = options->max_children;
                                         }
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_array_element_export_xml_node, 4, level, node, name, options);
+ zend_hash_apply_with_arguments(myht XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_array_element_export_xml_node, 4, level, node, name, options);
                                 }
                         } else {
                                 xdebug_xml_add_attribute(node, "recursive", "1");
@@ -749,7 +761,7 @@
                                                         options->runtime[level].start_element_nr = 0;
                                                         options->runtime[level].end_element_nr = options->max_children;
                                                 }
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_object_element_export_xml_node, 4, level, node, name, options);
+ zend_hash_apply_with_arguments(myht XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_object_element_export_xml_node, 4, level, node, name, options);
                                         }
                                 } else {
                                         xdebug_xml_add_attribute(node, "recursive", "1");
@@ -809,13 +821,15 @@
 #define COLOR_OBJECT "#8f5902"
 #define COLOR_RESOURCE "#2e3436"
 
-static int xdebug_array_element_export_fancy(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
+static int xdebug_array_element_export_fancy(zval **zv XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 {
         int level, debug_zval, newlen;
         char *tmp_str;
         xdebug_str *str;
         xdebug_var_export_options *options;
+#if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300
         TSRMLS_FETCH();
+#endif
 
         level = va_arg(args, int);
         str = va_arg(args, struct xdebug_str*);
@@ -846,14 +860,16 @@
         return 0;
 }
 
-static int xdebug_object_element_export_fancy(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
+static int xdebug_object_element_export_fancy(zval **zv XDEBUG_ZEND_HASH_APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 {
         int level, debug_zval;
         xdebug_str *str;
         xdebug_var_export_options *options;
         char *key;
         char *prop_name, *modifier;
+#if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300
         TSRMLS_FETCH();
+#endif
 
         level = va_arg(args, int);
         str = va_arg(args, struct xdebug_str*);
@@ -937,7 +953,7 @@
                                                 options->runtime[level].start_element_nr = 0;
                                                 options->runtime[level].end_element_nr = options->max_children;
 
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_array_element_export_fancy, 4, level, str, debug_zval, options);
+ zend_hash_apply_with_arguments(myht XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_array_element_export_fancy, 4, level, str, debug_zval, options);
                                         } else {
                                                 xdebug_str_add(str, xdebug_sprintf("%*s", (level * 4) - 2, ""), 1);
                                                 xdebug_str_add(str, xdebug_sprintf("<i><font color='%s'>empty</font></i>\n", COLOR_EMPTY), 1);
@@ -961,7 +977,7 @@
                                         options->runtime[level].start_element_nr = 0;
                                         options->runtime[level].end_element_nr = options->max_children;
 
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) xdebug_object_element_export_fancy, 4, level, str, debug_zval, options);
+ zend_hash_apply_with_arguments(myht XDEBUG_ZEND_HASH_APPLY_TSRMLS_CC, (apply_func_args_t) xdebug_object_element_export_fancy, 4, level, str, debug_zval, options);
                                 } else {
                                         xdebug_str_add(str, xdebug_sprintf("%*s...\n", (level * 4) - 2, ""), 1);
                                 }
Received on Sat Mar 28 2009 - 16:58:20 GMT

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