[xdebug-dev] xdebug xdebug/xdebug_handler_dbgp.c numeric index.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Mon, 23 Oct 2006 22:35:54 +0200

Date: Mon Oct 23 22:35:53 CEST 2006
User: Derick Rethans
Directory: xdebug

Log Message:
- Fixed bug #215: Cannot retrieve nested arrays when the array key is a
  numeric index.

Modified files:
           xdebug/xdebug_handler_dbgp.c (version: 1.103)

[FILE: /xdebug/xdebug_handler_dbgp.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -r1.102 -r1.103
--- xdebug/xdebug_handler_dbgp.c:1.102 Fri Oct 20 04:51:30 2006 GMT
+++ xdebug/xdebug_handler_dbgp.c Mon Oct 23 18:35:53 2006 GMT
@@ -257,9 +257,10 @@
 /*****************************************************************************
 ** Data returning functions
 */
-#define XF_ST_ROOT 0
-#define XF_ST_ARRAY_INDEX 1
-#define XF_ST_OBJ_PROPERTY 2
+#define XF_ST_ROOT 0
+#define XF_ST_ARRAY_INDEX_NUM 1
+#define XF_ST_ARRAY_INDEX_ASSOC 2
+#define XF_ST_OBJ_PROPERTY 3
 
 static char* prepare_search_key(char *name, int *name_length, char *prefix, int prefix_length)
 {
@@ -293,7 +294,7 @@
 
         switch (type) {
                 case XF_ST_ROOT:
- case XF_ST_ARRAY_INDEX:
+ case XF_ST_ARRAY_INDEX_ASSOC:
                         element = prepare_search_key(name, &name_length, "", 0);
 #ifdef ZEND_ENGINE_2
                         /* Handle "this" in a different way */
@@ -307,6 +308,12 @@
                                 goto cleanup;
                         }
                         break;
+ case XF_ST_ARRAY_INDEX_NUM:
+ if (ht && zend_hash_index_find(ht, strtoul(element, NULL, 10), (void **) &retval_pp) == SUCCESS) {
+ retval_p = *retval_pp;
+ goto cleanup_num;
+ }
+ break;
                 case XF_ST_OBJ_PROPERTY:
                         /* First we try a public property */
                         element = prepare_search_key(name, &element_length, "", 0);
@@ -336,6 +343,7 @@
         }
 cleanup:
         free(element);
+cleanup_num:
         return retval_p;
 }
 
@@ -430,7 +438,6 @@
                                                                 keyword = NULL;
                                                         }
                                                         state = 3;
- type = XF_ST_ARRAY_INDEX;
                                                 } else if (*p[0] == '-') {
                                                         keyword_end = *p;
                                                         if (keyword) {
@@ -460,11 +467,13 @@
                                                         state = 4;
                                                         keyword = *p + 1;
                                                         quotechar = *p[0];
+ type = XF_ST_ARRAY_INDEX_ASSOC;
                                                 }
                                                 /* Numerical index */
                                                 if (*p[0] >= '0' && *p[0] <= '9') {
                                                         state = 6;
                                                         keyword = *p;
+ type = XF_ST_ARRAY_INDEX_NUM;
                                                 }
                                                 break;
                                         case 4:
@@ -2075,7 +2084,7 @@
 
 char *xdebug_dbgp_get_revision(void)
 {
- return "$Revision: 1.102 $";
+ return "$Revision: 1.103 $";
 }
 
 int xdebug_dbgp_cmdloop(xdebug_con *context TSRMLS_DC)
Received on Mon Oct 23 2006 - 22:35:57 BST

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