[xdebug-dev] xdebug xdebug/xdebug_var.c - Fixed bug #117: var_dump dows not work with "private".

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Thu, 10 Mar 2005 22:35:53 +0100

Date: Thu Mar 10 22:35:52 CET 2005
User: Derick Rethans
Directory: xdebug

Log Message:
[0.50]
- Fixed bug #117: var_dump dows not work with "private".

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

[FILE: /xdebug/xdebug_var.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.28.2.2
retrieving revision 1.28.2.3
diff -u -r1.28.2.2 -r1.28.2.3
--- xdebug/xdebug_var.c:1.28.2.2 Sat Nov 22 14:45:42 2003 GMT
+++ xdebug/xdebug_var.c Thu Mar 10 20:35:52 2005 GMT
@@ -137,6 +137,32 @@
 }
 
 /*****************************************************************************
+** PHP Variable related utility functions
+*/
+
+static char* xdebug_get_property_info(char *mangled_property, char **property_name)
+{
+#ifdef ZEND_ENGINE_2
+ char *prop_name, *class_name;
+
+ zend_unmangle_property_name(mangled_property, &class_name, &prop_name);
+ *property_name = prop_name;
+ if (class_name) {
+ if (class_name[0] == '*') {
+ return "protected";
+ } else {
+ return "private";
+ }
+ } else {
+ return "public";
+ }
+#else
+ *property_name = mangled_property;
+ return "var";
+#endif
+}
+
+/*****************************************************************************
 * ** Normal variable printing routines
 * */
 
@@ -163,13 +189,15 @@
 {
         int level;
         xdebug_str *str;
+ char *prop_name, *modifier;
         TSRMLS_FETCH();
 
         level = va_arg(args, int);
         str = va_arg(args, struct xdebug_str*);
 
         if (hash_key->nKeyLength != 0) {
- XDEBUG_STR_ADD(str, xdebug_sprintf("var $%s = ", hash_key->arKey), 1);
+ modifier = xdebug_get_property_info(hash_key->arKey, &prop_name);
+ XDEBUG_STR_ADD(str, xdebug_sprintf("%s $%s = ", modifier, prop_name), 1);
         }
         xdebug_var_export(zv, str, level + 2 TSRMLS_CC);
         XDEBUG_STR_ADDL(str, "; ", 2, 0);
@@ -286,6 +314,7 @@
 {
         int level;
         xdebug_str *str;
+ char *prop_name, *modifier;
         TSRMLS_FETCH();
 
         level = va_arg(args, int);
@@ -293,7 +322,8 @@
 
         XDEBUG_STR_ADDL(str, "<var", 4, 0);
         if (hash_key->nKeyLength != 0) {
- XDEBUG_STR_ADD(str, xdebug_sprintf(" name='%s'", hash_key->arKey), 1);
+ modifier = xdebug_get_property_info(hash_key->arKey, &prop_name);
+ XDEBUG_STR_ADD(str, xdebug_sprintf(" name='%s' facet='%s'", prop_name, modifier), 1);
         }
         XDEBUG_STR_ADD(str, xdebug_sprintf(" id='%p'>", *zv), 1);
         xdebug_var_export_xml(zv, str, level + 2 TSRMLS_CC);
@@ -421,6 +451,7 @@
 {
         int level;
         xdebug_str *str;
+ char *prop_name, *modifier;
         TSRMLS_FETCH();
 
         level = va_arg(args, int);
@@ -429,7 +460,8 @@
         XDEBUG_STR_ADD(str, xdebug_sprintf("%*s", level * 2, ""), 1);
 
         if (hash_key->nKeyLength != 0) {
- XDEBUG_STR_ADD(str, xdebug_sprintf("'%s' <font color='%s'>=&gt;</font> ", hash_key->arKey, DGREY), 1);
+ modifier = xdebug_get_property_info(hash_key->arKey, &prop_name);
+ XDEBUG_STR_ADD(str, xdebug_sprintf("<i>%s</i> '%s' <font color='%s'>=&gt;</font> ", modifier, prop_name, DGREY), 1);
         }
         xdebug_var_export_fancy(zv, str, level + 2 TSRMLS_CC);
         return 0;
Received on Thu Mar 10 2005 - 22:36:02 GMT

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