Permalink
Browse files

Merged pull request #368

  • Loading branch information...
derickr committed Oct 15, 2017
2 parents 5043e4f + 2ddad8e commit 11898bd1687ea8c9a525c62dda60539eb8249e45
Showing with 139 additions and 290 deletions.
  1. +1 −1 config.m4
  2. +1 −1 config.w32
  3. +0 −2 package.xml
  4. +4 −4 tests/bug01272-2.phpt
  5. +23 −20 xdebug.c
  6. +0 −69 xdebug_collection.c
  7. +0 −42 xdebug_collection.h
  8. +22 −24 xdebug_handler_dbgp.c
  9. +6 −12 xdebug_stack.c
  10. +81 −113 xdebug_var.c
  11. +1 −2 xdebug_var.h
View
@@ -30,7 +30,7 @@ if test "$PHP_XDEBUG" != "no"; then
CPPFLAGS=$old_CPPFLAGS
PHP_NEW_EXTENSION(xdebug, xdebug.c xdebug_branch_info.c xdebug_code_coverage.c xdebug_collection.c xdebug_com.c xdebug_compat.c xdebug_handler_dbgp.c xdebug_handlers.c xdebug_llist.c xdebug_monitor.c xdebug_hash.c xdebug_private.c xdebug_profiler.c xdebug_set.c xdebug_stack.c xdebug_str.c xdebug_superglobals.c xdebug_tracing.c xdebug_trace_textual.c xdebug_trace_computerized.c xdebug_trace_html.c xdebug_var.c xdebug_xml.c usefulstuff.c, $ext_shared,,,,yes)
PHP_NEW_EXTENSION(xdebug, xdebug.c xdebug_branch_info.c xdebug_code_coverage.c xdebug_com.c xdebug_compat.c xdebug_handler_dbgp.c xdebug_handlers.c xdebug_llist.c xdebug_monitor.c xdebug_hash.c xdebug_private.c xdebug_profiler.c xdebug_set.c xdebug_stack.c xdebug_str.c xdebug_superglobals.c xdebug_tracing.c xdebug_trace_textual.c xdebug_trace_computerized.c xdebug_trace_html.c xdebug_var.c xdebug_xml.c usefulstuff.c, $ext_shared,,,,yes)
PHP_SUBST(XDEBUG_SHARED_LIBADD)
PHP_ADD_MAKEFILE_FRAGMENT
fi
View
@@ -4,6 +4,6 @@
ARG_WITH("xdebug", "Xdebug support", "no");
if (PHP_XDEBUG == "yes") {
EXTENSION("xdebug", "xdebug.c xdebug_branch_info.c xdebug_code_coverage.c xdebug_collection.c xdebug_com.c xdebug_compat.c xdebug_handler_dbgp.c xdebug_handlers.c xdebug_llist.c xdebug_monitor.c xdebug_hash.c xdebug_private.c xdebug_profiler.c xdebug_set.c xdebug_stack.c xdebug_str.c xdebug_superglobals.c xdebug_tracing.c xdebug_trace_textual.c xdebug_trace_computerized.c xdebug_trace_html.c xdebug_var.c xdebug_xml.c usefulstuff.c");
EXTENSION("xdebug", "xdebug.c xdebug_branch_info.c xdebug_code_coverage.c xdebug_com.c xdebug_compat.c xdebug_handler_dbgp.c xdebug_handlers.c xdebug_llist.c xdebug_monitor.c xdebug_hash.c xdebug_private.c xdebug_profiler.c xdebug_set.c xdebug_stack.c xdebug_str.c xdebug_superglobals.c xdebug_tracing.c xdebug_trace_textual.c xdebug_trace_computerized.c xdebug_trace_html.c xdebug_var.c xdebug_xml.c usefulstuff.c");
AC_DEFINE("HAVE_XDEBUG", 1, "Xdebug support");
}
View
@@ -118,8 +118,6 @@ Sun, Dec 4, 2016 - xdebug 2.5.0
<file name="xdebug_branch_info.h" role="src" />
<file name="xdebug_code_coverage.c" role="src" />
<file name="xdebug_code_coverage.h" role="src" />
<file name="xdebug_collection.c" role="src" />
<file name="xdebug_collection.h" role="src" />
<file name="xdebug_com.c" role="src" />
<file name="xdebug_com.h" role="src" />
<file name="xdebug_compat.c" role="src" />
View
@@ -14,7 +14,7 @@ xdebug_debug_zval('e->b[1]->@attributes["attb"]');
attb-1
attb-2
e: (refcount=1, is_ref=0)=class SimpleXMLElement { public $@attributes = (refcount=1, is_ref=0)=array ('att1' => (refcount=1, is_ref=0)='att-a'); public $b = (refcount=1, is_ref=0)=array (0 => (refcount=1, is_ref=0)=class SimpleXMLElement { ... }, 1 => (refcount=1, is_ref=0)=class SimpleXMLElement { ... }) }
e->@attributes: (refcount=1, is_ref=0)=array ('att1' => (refcount=1, is_ref=0)='att-a')
e->@attributes["att1"]: (refcount=1, is_ref=0)='att-a'
e->b[0]->@attributes: (refcount=1, is_ref=0)=array ('attb' => (refcount=1, is_ref=0)='attb-1')
e->b[1]->@attributes["attb"]: (refcount=1, is_ref=0)='attb-2'
e->@attributes: (refcount=0, is_ref=0)=array ('att1' => (refcount=1, is_ref=0)='att-a')
e->@attributes["att1"]: (refcount=0, is_ref=0)='att-a'
e->b[0]->@attributes: (refcount=0, is_ref=0)=array ('attb' => (refcount=1, is_ref=0)='attb-1')
e->b[1]->@attributes["attb"]: (refcount=0, is_ref=0)='attb-2'
View
@@ -52,7 +52,6 @@
#include "php_xdebug.h"
#include "xdebug_private.h"
#include "xdebug_code_coverage.h"
#include "xdebug_collection.h"
#include "xdebug_com.h"
#include "xdebug_llist.h"
#include "xdebug_mm.h"
@@ -2106,7 +2105,6 @@ PHP_FUNCTION(xdebug_debug_zval)
int argc;
int i, len;
char *val;
zval *debugzval;
argc = ZEND_NUM_ARGS();
@@ -2126,35 +2124,39 @@ PHP_FUNCTION(xdebug_debug_zval)
for (i = 0; i < argc; i++) {
if (Z_TYPE(args[i]) == IS_STRING) {
xdebug_ptr_collection *hashes_to_free = xdebug_ptr_collection_ctor(xdebug_free_hash_table);
zval debugzval;
XG(active_symbol_table) = EG(current_execute_data)->prev_execute_data->symbol_table;
XG(active_execute_data) = EG(current_execute_data)->prev_execute_data;
debugzval = xdebug_get_php_symbol(Z_STRVAL(args[i]), hashes_to_free TSRMLS_CC);
xdebug_get_php_symbol(&debugzval, Z_STRVAL(args[i]) TSRMLS_CC);
/* Reduce refcount for dumping */
Z_TRY_DELREF(debugzval);
php_printf("%s: ", Z_STRVAL(args[i]));
if (debugzval && Z_TYPE_P(debugzval) != IS_UNDEF) {
if (Z_TYPE(debugzval) != IS_UNDEF) {
if (PG(html_errors)) {
val = xdebug_get_zval_value_fancy(NULL, debugzval, &len, 1, NULL TSRMLS_CC);
val = xdebug_get_zval_value_fancy(NULL, &debugzval, &len, 1, NULL TSRMLS_CC);
PHPWRITE(val, len);
}
else if ((XG(cli_color) == 1 && xdebug_is_output_tty(TSRMLS_C)) || (XG(cli_color) == 2)) {
val = xdebug_get_zval_value_ansi(debugzval, 1, NULL);
val = xdebug_get_zval_value_ansi(&debugzval, 1, NULL);
PHPWRITE(val, strlen(val));
}
else {
val = xdebug_get_zval_value(debugzval, 1, NULL);
val = xdebug_get_zval_value(&debugzval, 1, NULL);
PHPWRITE(val, strlen(val));
}
xdfree(val);
PHPWRITE("\n", 1);
} else {
PHPWRITE("no such symbol\n", 15);
}
efree(debugzval);
/* Clean up the hashes that were copied */
xdebug_ptr_collection_dtor(hashes_to_free);
/* Restore original refcount */
Z_TRY_ADDREF(debugzval);
zval_ptr_dtor_nogc(&debugzval);
}
}
@@ -2170,7 +2172,6 @@ PHP_FUNCTION(xdebug_debug_zval_stdout)
int argc;
int i;
char *val;
zval *debugzval;
argc = ZEND_NUM_ARGS();
@@ -2190,26 +2191,28 @@ PHP_FUNCTION(xdebug_debug_zval_stdout)
for (i = 0; i < argc; i++) {
if (Z_TYPE(args[i]) == IS_STRING) {
xdebug_ptr_collection *hashes_to_free;
zval debugzval;
XG(active_symbol_table) = EG(current_execute_data)->symbol_table;
hashes_to_free = xdebug_ptr_collection_ctor(xdebug_free_hash_table);
xdebug_get_php_symbol(&debugzval, Z_STRVAL(args[i]) TSRMLS_CC);
/* Reduce refcount for dumping */
Z_TRY_DELREF(debugzval);
debugzval = xdebug_get_php_symbol(Z_STRVAL(args[i]), hashes_to_free TSRMLS_CC);
printf("%s: ", Z_STRVAL(args[i]));
if (debugzval && Z_TYPE_P(debugzval) != IS_UNDEF) {
val = xdebug_get_zval_value(debugzval, 1, NULL);
if (Z_TYPE(debugzval) != IS_UNDEF) {
val = xdebug_get_zval_value(&debugzval, 1, NULL);
printf("%s(%zd)", val, strlen(val));
xdfree(val);
printf("\n");
} else {
printf("no such symbol\n\n");
}
efree(debugzval);
/* Clean up the hashes that were copied */
xdebug_ptr_collection_dtor(hashes_to_free);
/* Restore original refcount */
Z_TRY_ADDREF(debugzval);
zval_ptr_dtor_nogc(&debugzval);
}
}
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View
@@ -274,17 +274,16 @@ static void send_message(xdebug_con *context, xdebug_xml_node *message TSRMLS_DC
static xdebug_xml_node* get_symbol(char* name, xdebug_var_export_options *options TSRMLS_DC)
{
zval *retval;
xdebug_ptr_collection *hashes_to_free = xdebug_ptr_collection_ctor(xdebug_free_hash_table);
zval retval;
xdebug_xml_node *tmp_node;
retval = xdebug_get_php_symbol(name, hashes_to_free TSRMLS_CC);
if (retval && Z_TYPE_P(retval) != IS_UNDEF) {
if (strcmp(name, "this") == 0 && Z_TYPE_P(retval) == IS_NULL) {
xdebug_get_php_symbol(&retval, name TSRMLS_CC);
if (Z_TYPE(retval) != IS_UNDEF) {
if (strcmp(name, "this") == 0 && Z_TYPE(retval) == IS_NULL) {
return NULL;
}
tmp_node = xdebug_get_zval_value_xml_node(name, retval, options TSRMLS_CC);
xdebug_ptr_collection_dtor(hashes_to_free);
tmp_node = xdebug_get_zval_value_xml_node(name, &retval, options TSRMLS_CC);
zval_ptr_dtor_nogc(&retval);
return tmp_node;
}
@@ -293,13 +292,14 @@ static xdebug_xml_node* get_symbol(char* name, xdebug_var_export_options *option
static int get_symbol_contents(char* name, xdebug_xml_node *node, xdebug_var_export_options *options TSRMLS_DC)
{
zval *retval;
xdebug_ptr_collection *hashes_to_free = xdebug_ptr_collection_ctor(xdebug_free_hash_table);
zval retval;
retval = xdebug_get_php_symbol(name, hashes_to_free TSRMLS_CC);
if (retval) {
xdebug_var_export_xml_node(&retval, name, node, options, 1 TSRMLS_CC);
xdebug_ptr_collection_dtor(hashes_to_free);
xdebug_get_php_symbol(&retval, name TSRMLS_CC);
if (Z_TYPE(retval) != IS_UNDEF) {
// TODO WTF???
zval *retval_ptr = &retval;
xdebug_var_export_xml_node(&retval_ptr, name, node, options, 1 TSRMLS_CC);
zval_ptr_dtor_nogc(&retval);
return 1;
}
@@ -1418,7 +1418,6 @@ DBGP_FUNC(property_set)
zval ret_zval;
function_stack_entry *fse;
xdebug_var_export_options *options = (xdebug_var_export_options*) context->options;
zval *symbol;
zend_execute_data *original_execute_data;
XDEBUG_STR_SWITCH_DECL;
@@ -1467,31 +1466,30 @@ DBGP_FUNC(property_set)
new_value = xdebug_base64_decode((unsigned char*) data, strlen(data), &new_length);
if (CMD_OPTION('t')) {
xdebug_ptr_collection *hashes_to_free = xdebug_ptr_collection_ctor(xdebug_free_hash_table);
symbol = xdebug_get_php_symbol(CMD_OPTION('n'), hashes_to_free TSRMLS_CC);
zval symbol;
xdebug_get_php_symbol(&symbol, CMD_OPTION('n') TSRMLS_CC);
/* Handle result */
if (!symbol) {
if (Z_TYPE(symbol) == IS_UNDEF) {
efree(new_value);
RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_PROPERTY_NON_EXISTENT);
} else {
zval_dtor(symbol);
xdebug_ptr_collection_dtor(hashes_to_free);
ZVAL_STRINGL(symbol, (char*) new_value, new_length);
// TODO Doesn't make sense anymore in this form
zval_ptr_dtor_nogc(&symbol);
ZVAL_STRINGL(&symbol, (char*) new_value, new_length);
xdebug_xml_add_attribute(*retval, "success", "1");
XDEBUG_STR_SWITCH(CMD_OPTION('t')) {
XDEBUG_STR_CASE("bool")
convert_to_boolean(symbol);
convert_to_boolean(&symbol);
XDEBUG_STR_CASE_END
XDEBUG_STR_CASE("int")
convert_to_long(symbol);
convert_to_long(&symbol);
XDEBUG_STR_CASE_END
XDEBUG_STR_CASE("float")
convert_to_double(symbol);
convert_to_double(&symbol);
XDEBUG_STR_CASE_END
XDEBUG_STR_CASE("string")
Oops, something went wrong.

0 comments on commit 11898bd

Please sign in to comment.