[xdebug-dev] xdebug xdebug/php_xdebug.h xdebug/xdebug.c xdebug/xdebug_handler_dbgp.c xdebug/xdebug_private.h - Fixed bug #283: Xdebug always return $this with the value of last stack frame

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Sun, 24 Jun 2007 22:20:17 +0200

Date: Sun Jun 24 22:20:17 CEST 2007
User: Derick Rethans
Directory: xdebug

Log Message:
[8.00]
- Fixed bug #283: Xdebug always return $this with the value of last stack frame
  in all stack frames.

Modified files:
           xdebug/php_xdebug.h (version: 1.132)
           xdebug/xdebug.c (version: 1.395)
           xdebug/xdebug_handler_dbgp.c (version: 1.124)
           xdebug/xdebug_private.h (version: 1.26)

[FILE: /xdebug/php_xdebug.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -r1.131 -r1.132
--- xdebug/php_xdebug.h:1.131 Sun May 27 19:25:51 2007 GMT
+++ xdebug/php_xdebug.h Sun Jun 24 18:20:17 2007 GMT
@@ -132,6 +132,7 @@
         char *manual_url;
         double start_time;
         HashTable *active_symbol_table;
+ zend_execute_data *active_execute_data;
         unsigned int prev_memory;
 
         void (*orig_var_dump_func)(INTERNAL_FUNCTION_PARAMETERS);

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.394
retrieving revision 1.395
diff -u -r1.394 -r1.395
--- xdebug/xdebug.c:1.394 Sat Jun 09 20:00:37 2007 GMT
+++ xdebug/xdebug.c Sun Jun 24 18:20:17 2007 GMT
@@ -991,6 +991,7 @@
         tmp->profile.call_list = xdebug_llist_alloc(xdebug_profile_call_entry_dtor);
         tmp->op_array = op_array;
         tmp->symbol_table = NULL;
+ tmp->execute_data = NULL;
 
         if (EG(current_execute_data) && EG(current_execute_data)->op_array) {
                 /* Normal function calls */
@@ -1460,6 +1461,7 @@
         trace_function_begin(fse, function_nr TSRMLS_CC);
 
         fse->symbol_table = EG(active_symbol_table);
+ fse->execute_data = EG(current_execute_data);
 
         if (XG(remote_enabled) || XG(collect_vars) || XG(show_local_vars)) {
                 /* Because include/require is treated as a stack level, we have to add used
@@ -1529,6 +1531,7 @@
         }
 
         fse->symbol_table = NULL;
+ fse->execute_data = NULL;
         xdebug_llist_remove(XG(stack), XDEBUG_LLIST_TAIL(XG(stack)), xdebug_stack_element_dtor);
         XG(level)--;
 }

[FILE: /xdebug/xdebug_handler_dbgp.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -r1.123 -r1.124
--- xdebug/xdebug_handler_dbgp.c:1.123 Thu May 31 17:02:15 2007 GMT
+++ xdebug/xdebug_handler_dbgp.c Sun Jun 24 18:20:17 2007 GMT
@@ -306,7 +306,11 @@
 #ifdef ZEND_ENGINE_2
                         /* Handle "this" in a different way */
                         if (type == XF_ST_ROOT && strcmp("this", element) == 0) {
- retval_p = EG(This);
+ if (XG(active_execute_data)) {
+ retval_p = XG(active_execute_data)->object;
+ } else {
+ retval_p = NULL;
+ }
                                 goto cleanup;
                         }
 #endif
@@ -1589,7 +1593,7 @@
 
 DBGP_FUNC(property_get)
 {
- int depth = -1;
+ int depth = 0;
         int context_nr = 0;
         function_stack_entry *fse;
         int old_max_data;
@@ -1609,14 +1613,11 @@
 
         /* Set the symbol table corresponding with the requested stack depth */
         if (context_nr == 0) { /* locals */
- if (depth == -1) {
- XG(active_symbol_table) = EG(active_symbol_table);
+ if ((fse = xdebug_get_stack_frame(depth TSRMLS_CC))) {
+ XG(active_symbol_table) = fse->symbol_table;
+ XG(active_execute_data) = fse->execute_data;
                 } else {
- if ((fse = xdebug_get_stack_frame(depth TSRMLS_CC))) {
- XG(active_symbol_table) = fse->symbol_table;
- } else {
- RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_STACK_DEPTH_INVALID);
- }
+ RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_STACK_DEPTH_INVALID);
                 }
         } else { /* superglobals */
                 XG(active_symbol_table) = &EG(symbol_table);
@@ -1644,7 +1645,7 @@
         char *data = CMD_OPTION('-');
         char *new_value;
         int new_length;
- int depth = -1;
+ int depth = 0;
         int context_nr = 0;
         int res;
         char *eval_string;
@@ -1672,14 +1673,11 @@
 
         /* Set the symbol table corresponding with the requested stack depth */
         if (context_nr == 0) { /* locals */
- if (depth == -1) {
- XG(active_symbol_table) = EG(active_symbol_table);
+ if ((fse = xdebug_get_stack_frame(depth TSRMLS_CC))) {
+ XG(active_symbol_table) = fse->symbol_table;
+ XG(active_execute_data) = fse->execute_data;
                 } else {
- if ((fse = xdebug_get_stack_frame(depth TSRMLS_CC))) {
- XG(active_symbol_table) = fse->symbol_table;
- } else {
- RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_STACK_DEPTH_INVALID);
- }
+ RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_STACK_DEPTH_INVALID);
                 }
         } else { /* superglobals */
                 XG(active_symbol_table) = &EG(symbol_table);
@@ -1762,7 +1760,7 @@
 
 DBGP_FUNC(property_value)
 {
- int depth = -1;
+ int depth = 0;
         function_stack_entry *fse;
         int old_max_data;
         xdebug_var_export_options *options = (xdebug_var_export_options*) context->options;
@@ -1774,15 +1772,13 @@
         if (CMD_OPTION('d')) {
                 depth = strtol(CMD_OPTION('d'), NULL, 10);
         }
+
         /* Set the symbol table corresponding with the requested stack depth */
- if (depth == -1) {
- XG(active_symbol_table) = EG(active_symbol_table);
+ if ((fse = xdebug_get_stack_frame(depth TSRMLS_CC))) {
+ XG(active_symbol_table) = fse->symbol_table;
+ XG(active_execute_data) = fse->execute_data;
         } else {
- if ((fse = xdebug_get_stack_frame(depth TSRMLS_CC))) {
- XG(active_symbol_table) = fse->symbol_table;
- } else {
- RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_STACK_DEPTH_INVALID);
- }
+ RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_STACK_DEPTH_INVALID);
         }
 
         if (CMD_OPTION('p')) {
@@ -1852,6 +1848,7 @@
         /* Here the context_id is 0 */
         if ((fse = xdebug_get_stack_frame(depth TSRMLS_CC))) {
                 XG(active_symbol_table) = fse->symbol_table;
+ XG(active_execute_data) = fse->execute_data;
 
                 /* Only show vars when they are scanned */
                 if (fse->used_vars) {
@@ -1867,6 +1864,7 @@
 #endif
 
                 XG(active_symbol_table) = NULL;
+ XG(active_execute_data) = NULL;
                 return 0;
         }
         
@@ -2195,7 +2193,7 @@
 
 char *xdebug_dbgp_get_revision(void)
 {
- return "$Revision: 1.123 $";
+ return "$Revision: 1.124 $";
 }
 
 static int xdebug_dbgp_cmdloop(xdebug_con *context TSRMLS_DC)

[FILE: /xdebug/xdebug_private.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- xdebug/xdebug_private.h:1.25 Wed Apr 04 09:10:25 2007 GMT
+++ xdebug/xdebug_private.h Sun Jun 24 18:20:17 2007 GMT
@@ -163,6 +163,7 @@
         zval *return_value;
         xdebug_llist *used_vars;
         HashTable *symbol_table;
+ zend_execute_data *execute_data;
 
         /* tracing properties */
         signed long memory;
Received on Sun Jun 24 2007 - 22:20:20 BST

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