diff --git a/tests/bug00305.phpt b/tests/bug00305.phpt index 6bd921d59..11fa8c847 100644 --- a/tests/bug00305.phpt +++ b/tests/bug00305.phpt @@ -10,7 +10,7 @@ throw new Exception(""); ?> --EXPECTF--
- +
diff --git a/tests/bug00340.phpt b/tests/bug00340.phpt index 80cf45191..c6bd83552 100644 --- a/tests/bug00340.phpt +++ b/tests/bug00340.phpt @@ -21,14 +21,14 @@ throw new MyException(); ?> --EXPECTF--
-
( ! ) Fatal error: Uncaught exception 'Exception' with message '<MARK>' in %sbug00305.php on line 2
( ! ) Exception: <MARK> in %sbug00305.php on line 2
Call Stack
+
( ! ) Notice: Array to string conversion in %sbug00340.php on line 11
Call Stack
#TimeMemoryFunctionLocation
1%f%d{main}( )../bug00340.php:0

- +
diff --git a/tests/bug00635.phpt b/tests/bug00635.phpt index 21f127b63..e88f555b0 100644 --- a/tests/bug00635.phpt +++ b/tests/bug00635.phpt @@ -19,21 +19,21 @@ throw new Exception('Uncaught exception'); ?> --EXPECTF--
-
( ! ) Fatal error: Uncaught exception 'MyException' with message 'Array' in %sbug00340.php on line 11
( ! ) MyException: Array in %sbug00340.php on line 11
Call Stack
+
( ! ) Exception: Caught exception in %sbug00635.php on line 4
Call Stack
#TimeMemoryFunctionLocation
1%f%d{main}( )../bug00635.php:0

- +
( ! ) Exception: Uncaught exception in %sbug00635.php on line 9
Call Stack
#TimeMemoryFunctionLocation
1%f%d{main}( )../bug00635.php:0

- +
diff --git a/tests/stacktrace_html_0.phpt b/tests/stacktrace_html_0.phpt index 8dd4e2797..f98257ceb 100644 --- a/tests/stacktrace_html_0.phpt +++ b/tests/stacktrace_html_0.phpt @@ -30,7 +30,7 @@ foo( $a ); ?> --EXPECTF--
-
( ! ) Fatal error: Uncaught exception 'Exception' with message 'Uncaught exception' in %sbug00635.php on line 9
( ! ) Exception: Uncaught exception in %sbug00635.php on line 9
Call Stack
+
diff --git a/tests/stacktrace_html_1.phpt b/tests/stacktrace_html_1.phpt index 16546ac10..5a1116b5d 100644 --- a/tests/stacktrace_html_1.phpt +++ b/tests/stacktrace_html_1.phpt @@ -30,7 +30,7 @@ foo( $a ); ?> --EXPECTF--
-
( ! ) Fatal error: Call to undefined function poo() in /%s/stacktrace_html_0.php on line 4
Call Stack
#TimeMemoryFunctionLocation
+
diff --git a/tests/stacktrace_html_2.phpt b/tests/stacktrace_html_2.phpt index ab998d81b..3874b01a3 100644 --- a/tests/stacktrace_html_2.phpt +++ b/tests/stacktrace_html_2.phpt @@ -33,7 +33,7 @@ foo( $a ); ?> --EXPECTF--
-
( ! ) Fatal error: Call to undefined function poo() in /%s/stacktrace_html_1.php on line 4
Call Stack
#TimeMemoryFunctionLocation
+
diff --git a/tests/stacktrace_html_3.phpt b/tests/stacktrace_html_3.phpt index d265abec6..7612e3d9c 100644 --- a/tests/stacktrace_html_3.phpt +++ b/tests/stacktrace_html_3.phpt @@ -33,7 +33,7 @@ foo( $a ); ?> --EXPECTF--
-
( ! ) Fatal error: Call to undefined function poo() in /%s/stacktrace_html_2.php on line 4
Call Stack
#TimeMemoryFunctionLocation
+
diff --git a/tests/stacktrace_html_4.phpt b/tests/stacktrace_html_4.phpt index 54f68509c..71638b925 100644 --- a/tests/stacktrace_html_4.phpt +++ b/tests/stacktrace_html_4.phpt @@ -33,7 +33,7 @@ foo( $a ); ?> --EXPECTF--
-
( ! ) Fatal error: Call to undefined function poo() in /%s/stacktrace_html_3.php on line 4
Call Stack
#TimeMemoryFunctionLocation
+
diff --git a/tests/stacktrace_html_4_novar.phpt b/tests/stacktrace_html_4_novar.phpt index c831af8d4..7efdec129 100644 --- a/tests/stacktrace_html_4_novar.phpt +++ b/tests/stacktrace_html_4_novar.phpt @@ -33,7 +33,7 @@ foo( $a ); ?> --EXPECTF--
-
( ! ) Fatal error: Call to undefined function poo() in /%s/stacktrace_html_4.php on line 4
Call Stack
#TimeMemoryFunctionLocation
+
diff --git a/xdebug.c b/xdebug.c index 59adc4f81..cbc919166 100644 --- a/xdebug.c +++ b/xdebug.c @@ -1083,7 +1083,7 @@ static void xdebug_throw_exception_hook(zval *exception TSRMLS_DC) } if (PG(display_errors)) { xdebug_str tmp_str = { 0, 0, NULL }; - xdebug_append_error_head(&tmp_str, PG(html_errors) TSRMLS_CC); + xdebug_append_error_head(&tmp_str, PG(html_errors), "exception" TSRMLS_CC); xdebug_str_add(&tmp_str, exception_trace, 0); xdebug_append_error_footer(&tmp_str, PG(html_errors) TSRMLS_CC); diff --git a/xdebug_stack.c b/xdebug_stack.c index 8f9fa5f21..4bb18bcad 100644 --- a/xdebug_stack.c +++ b/xdebug_stack.c @@ -67,7 +67,7 @@ static char* ansi_formats[10] = { #endif static char* html_formats[12] = { - "
\n
( ! ) Fatal error: Call to undefined function poo() in /%s/stacktrace_html_4_novar.php on line 4
Call Stack
#TimeMemoryFunctionLocation
\n", + "
\n
\n", "\n", #if HAVE_PHP_MEMORY_USAGE "\n\n", @@ -246,11 +246,15 @@ static int create_file_link(char **filename, const char *error_filename, int err return fname.l; } -void xdebug_append_error_head(xdebug_str *str, int html TSRMLS_DC) +void xdebug_append_error_head(xdebug_str *str, int html, char *error_type_str TSRMLS_DC) { char **formats = select_formats(html TSRMLS_CC); - - xdebug_str_add(str, formats[0], 0); + + if (html) { + xdebug_str_add(str, xdebug_sprintf(formats[0], error_type_str), 1); + } else { + xdebug_str_add(str, formats[0], 0); + } } void xdebug_append_error_description(xdebug_str *str, int html, const char *error_type_str, char *buffer, const char *error_filename, const int error_lineno TSRMLS_DC) @@ -437,22 +441,27 @@ void xdebug_append_error_footer(xdebug_str *str, int html TSRMLS_DC) xdebug_str_add(str, formats[7], 0); } -static char *get_printable_stack(int html, const char *error_type_str, char *buffer, const char *error_filename, const int error_lineno TSRMLS_DC) +static char *get_printable_stack(int html, int error_type, char *buffer, const char *error_filename, const int error_lineno TSRMLS_DC) { char *prepend_string; char *append_string; + char *error_type_str = xdebug_error_type(error_type); + char *error_type_str_simple = xdebug_error_type_simple(error_type); xdebug_str str = {0, 0, NULL}; prepend_string = INI_STR("error_prepend_string"); append_string = INI_STR("error_append_string"); xdebug_str_add(&str, prepend_string ? prepend_string : "", 0); - xdebug_append_error_head(&str, html TSRMLS_CC); + xdebug_append_error_head(&str, html, error_type_str_simple TSRMLS_CC); xdebug_append_error_description(&str, html, error_type_str, buffer, error_filename, error_lineno TSRMLS_CC); xdebug_append_printable_stack(&str, html TSRMLS_CC); xdebug_append_error_footer(&str, html TSRMLS_CC); xdebug_str_add(&str, append_string ? append_string : "", 0); + xdfree(error_type_str); + xdfree(error_type_str_simple); + return str.d; } @@ -614,7 +623,7 @@ void xdebug_error_cb(int type, const char *error_filename, const uint error_line strncpy(tmp_buf, buffer, p - buffer ); /* Append error */ - xdebug_append_error_head(&str, PG(html_errors) TSRMLS_CC); + 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); @@ -624,14 +633,14 @@ void xdebug_error_cb(int type, const char *error_filename, const uint error_line xdfree(str.d); free(tmp_buf); } else { - printable_stack = get_printable_stack(PG(html_errors), error_type_str, buffer, error_filename, error_lineno TSRMLS_CC); + printable_stack = get_printable_stack(PG(html_errors), type, buffer, error_filename, error_lineno TSRMLS_CC); php_output_error(printable_stack TSRMLS_CC); xdfree(printable_stack); } } if (XG(do_collect_errors)) { char *printable_stack; - printable_stack = get_printable_stack(PG(html_errors), error_type_str, buffer, error_filename, error_lineno TSRMLS_CC); + printable_stack = get_printable_stack(PG(html_errors), type, buffer, error_filename, error_lineno TSRMLS_CC); xdebug_llist_insert_next(XG(collected_errors), XDEBUG_LLIST_TAIL(XG(collected_errors)), printable_stack); } } @@ -747,9 +756,9 @@ PHP_FUNCTION(xdebug_print_function_stack) i = xdebug_get_stack_frame(0 TSRMLS_CC); if (message) { - tmp = get_printable_stack(PG(html_errors), "Xdebug", message, i->filename, i->lineno TSRMLS_CC); + tmp = get_printable_stack(PG(html_errors), 0, message, i->filename, i->lineno TSRMLS_CC); } else { - tmp = get_printable_stack(PG(html_errors), "Xdebug", "user triggered", i->filename, i->lineno TSRMLS_CC); + tmp = get_printable_stack(PG(html_errors), 0, "user triggered", i->filename, i->lineno TSRMLS_CC); } php_printf("%s", tmp); xdfree(tmp); @@ -764,7 +773,7 @@ PHP_FUNCTION(xdebug_get_formatted_function_stack) char *tmp; i = xdebug_get_stack_frame(0 TSRMLS_CC); - tmp = get_printable_stack(PG(html_errors), "Xdebug", "user triggered", i->filename, i->lineno TSRMLS_CC); + tmp = get_printable_stack(PG(html_errors), 0, "user triggered", i->filename, i->lineno TSRMLS_CC); RETVAL_STRING(tmp, 1); xdfree(tmp); } diff --git a/xdebug_stack.h b/xdebug_stack.h index 1297a9e81..a9fb2c605 100644 --- a/xdebug_stack.h +++ b/xdebug_stack.h @@ -22,7 +22,7 @@ #include "xdebug_str.h" function_stack_entry *xdebug_add_stack_frame(zend_execute_data *zdata, zend_op_array *op_array, int type TSRMLS_DC); -void xdebug_append_error_head(xdebug_str *str, int html TSRMLS_DC); +void xdebug_append_error_head(xdebug_str *str, int html, char *error_type_str TSRMLS_DC); void xdebug_append_error_description(xdebug_str *str, int html, const char *error_type_str, char *buffer, const char *error_filename, const int error_lineno TSRMLS_DC); void xdebug_append_printable_stack(xdebug_str *str, int html TSRMLS_DC); void xdebug_append_error_footer(xdebug_str *str, int html TSRMLS_DC); diff --git a/xdebug_var.c b/xdebug_var.c index bbbcaf410..df83549c2 100644 --- a/xdebug_var.c +++ b/xdebug_var.c @@ -31,6 +31,51 @@ ZEND_EXTERN_MODULE_GLOBALS(xdebug) +char* xdebug_error_type_simple(int type) +{ + switch (type) { + case E_ERROR: + case E_CORE_ERROR: + case E_COMPILE_ERROR: + case E_USER_ERROR: + return xdstrdup("fatal-error"); + break; +#if PHP_VERSION_ID >= 50200 + case E_RECOVERABLE_ERROR: + return xdstrdup("catchable-fatal-error"); + break; +#endif + case E_WARNING: + case E_CORE_WARNING: + case E_COMPILE_WARNING: + case E_USER_WARNING: + return xdstrdup("warning"); + break; + case E_PARSE: + return xdstrdup("parse-error"); + break; + case E_NOTICE: + case E_USER_NOTICE: + return xdstrdup("notice"); + break; + case E_STRICT: + return xdstrdup("strict-standards"); + break; +#if PHP_VERSION_ID >= 50300 + case E_DEPRECATED: + case E_USER_DEPRECATED: + return xdstrdup("deprecated"); + break; +#endif + case 0: + return xdstrdup("xdebug"); + break; + default: + return xdstrdup("unknown-error"); + break; + } +} + char* xdebug_error_type(int type) { switch (type) { @@ -67,6 +112,9 @@ char* xdebug_error_type(int type) return xdstrdup("Deprecated"); break; #endif + case 0: + return xdstrdup("Xdebug"); + break; default: return xdstrdup("Unknown error"); break; diff --git a/xdebug_var.h b/xdebug_var.h index 592c9cd91..18b734193 100644 --- a/xdebug_var.h +++ b/xdebug_var.h @@ -64,6 +64,7 @@ void xdebug_var_export_fancy(zval **struc, xdebug_str *str, int level, int debug void xdebug_var_export_xml_node(zval **struc, char *name, xdebug_xml_node *node, xdebug_var_export_options *options, int level TSRMLS_DC); char* xdebug_xmlize(char *string, int len, int *newlen); +char* xdebug_error_type_simple(int type); char* xdebug_error_type(int type); zval *xdebug_get_zval(zend_execute_data *zdata, int node_type, XDEBUG_ZNODE *node, temp_variable *Ts, int *is_var); char* xdebug_get_zval_value(zval *val, int debug_zval, xdebug_var_export_options *options);
( ! ) %s: %s in %s on line %d
Call Stack
#TimeMemoryFunctionLocation