Skip to content

Commit

Permalink
Merge branch 'xdebug_2_2'
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed May 19, 2013
2 parents 472878a + 8038ea8 commit 5c68b09
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 6 deletions.
16 changes: 16 additions & 0 deletions tests/bug00931.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
Test for bug #931: Crash with exception in shut-down stage
--SKIPIF--
<?php if (!version_compare(phpversion(), "5.3", '>=')) echo "skip >= PHP 5.3 needed\n"; ?>
--FILE--
<?php
session_start();
$_SESSION['test'] = function() { };
echo "DONE";
?>
--EXPECT--
DONE
Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'Closure' is not allowed' in [no active file]:0
Stack trace:
#0 {main}
thrown in [no active file] on line 0
16 changes: 16 additions & 0 deletions tests/bug00947-1.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
Test for bug #947: Newlines converted when html_errors = 0 (ansi)
--INI--
html_errors=0
xdebug.overload_var_dump=1
xdebug.cli_color=2
xdebug.default_enable=1
--FILE--
<?php
$t = "\0" . 'aze
rty\r\nqwerty';
var_dump($t, 4.34);
?>
--EXPECT--
string(18) "\000aze\nrty\\r\\nqwerty"
double(4.34)
17 changes: 17 additions & 0 deletions tests/bug00947-2.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--TEST--
Test for bug #947: Newlines converted when html_errors = 0 (plain)
--INI--
html_errors=0
xdebug.overload_var_dump=1
xdebug.cli_color=0
xdebug.default_enable=1
--FILE--
<?php
$t = "\0" . 'aze
rty\r\nqwerty';
var_dump($t, 4.34);
?>
--EXPECT--
string(18) "\000aze
rty\r\nqwerty"
double(4.34)
6 changes: 5 additions & 1 deletion xdebug_profiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ int xdebug_profiler_init(char *script_name TSRMLS_DC)
/* Invalid or empty xdebug.profiler_output_name */
return FAILURE;
}
filename = xdebug_sprintf("%s/%s", XG(profiler_output_dir), fname);
if (IS_SLASH(XG(profiler_output_dir)[strlen(XG(profiler_output_dir)) - 1])) {
filename = xdebug_sprintf("%s%s", XG(profiler_output_dir), fname);
} else {
filename = xdebug_sprintf("%s%c%s", XG(profiler_output_dir), DEFAULT_SLASH, fname);
}
xdfree(fname);

if (XG(profiler_append)) {
Expand Down
4 changes: 3 additions & 1 deletion xdebug_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,9 @@ void xdebug_error_cb(int type, const char *error_filename, const uint error_line
xdebug_append_error_head(&str, PG(html_errors), "uncaught-exception" TSRMLS_CC);
xdebug_append_error_description(&str, PG(html_errors), error_type_str, tmp_buf, error_filename, error_lineno TSRMLS_CC);
xdebug_append_printable_stack(&str, PG(html_errors) TSRMLS_CC);
xdebug_str_add(&str, XG(last_exception_trace), 0);
if (XG(last_exception_trace)) {
xdebug_str_add(&str, XG(last_exception_trace), 0);
}
xdebug_append_error_footer(&str, PG(html_errors) TSRMLS_CC);
php_output_error(str.d TSRMLS_CC);

Expand Down
7 changes: 6 additions & 1 deletion xdebug_tracing.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,12 @@ char* xdebug_start_trace(char* fname, long options TSRMLS_DC)
/* Invalid or empty xdebug.trace_output_name */
return NULL;
}
filename = xdebug_sprintf("%s/%s", XG(trace_output_dir), fname);
if (IS_SLASH(XG(trace_output_dir)[strlen(XG(trace_output_dir)) - 1])) {
filename = xdebug_sprintf("%s%s", XG(trace_output_dir), fname);
} else {
filename = xdebug_sprintf("%s%c%s", XG(trace_output_dir), DEFAULT_SLASH, fname);
}
xdfree(fname);
}
if (options & XDEBUG_TRACE_OPTION_APPEND) {
XG(trace_file) = xdebug_fopen(filename, "a", "xt", (char**) &tmp_fname);
Expand Down
10 changes: 7 additions & 3 deletions xdebug_var.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ void xdebug_var_export(zval **struc, xdebug_str *str, int level, int debug_zval,
break;

case IS_STRING:
tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "'\\\0..\37", 6 TSRMLS_CC);
tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "'\\\0..\37", 7 TSRMLS_CC);
if (options->no_decoration) {
xdebug_str_add(str, tmp_str, 0);
} else if (Z_STRLEN_PP(struc) <= options->max_data) {
Expand Down Expand Up @@ -711,9 +711,13 @@ void xdebug_var_export_text_ansi(zval **struc, xdebug_str *str, int mode, int le
break;

case IS_STRING:
tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "\0..\37", 5 TSRMLS_CC);
if (mode == 1) {
tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "'\\\0..\37", 7 TSRMLS_CC);
} else {
tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "\0", 1 TSRMLS_CC);
}
if (options->no_decoration) {
xdebug_str_add(str, tmp_str, 0);
xdebug_str_addl(str, tmp_str, tmp_len, 0);
} else if (Z_STRLEN_PP(struc) <= options->max_data) {
xdebug_str_add(str, xdebug_sprintf("%sstring%s(%s%ld%s) \"%s%s%s\"", ANSI_COLOR_BOLD, ANSI_COLOR_BOLD_OFF,
ANSI_COLOR_LONG, Z_STRLEN_PP(struc), ANSI_COLOR_RESET,
Expand Down

0 comments on commit 5c68b09

Please sign in to comment.