[xdebug-dev] xdebug xdebug/php_xdebug.h xdebug/xdebug.c - Fixed bug #181: Xdebug doesn't handle uncaught exception output correctly.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Sun, 8 Oct 2006 21:31:00 +0200

Date: Sun Oct 8 21:31:00 CEST 2006
User: Derick Rethans
Directory: xdebug

Log Message:
[0.50]
- Fixed bug #181: Xdebug doesn't handle uncaught exception output correctly.

Modified files:
           xdebug/php_xdebug.h (version: 1.117)
           xdebug/xdebug.c (version: 1.353)

[FILE: /xdebug/php_xdebug.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -r1.116 -r1.117
--- xdebug/php_xdebug.h:1.116 Fri Oct 06 12:23:03 2006 GMT
+++ xdebug/php_xdebug.h Sun Oct 08 17:31:00 2006 GMT
@@ -143,6 +143,7 @@
         long trace_options;
         long trace_format;
         char *tracefile_name;
+ char *last_exception_trace;
 
         /* variable dumping limitation settings */
         long display_max_children;

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.352
retrieving revision 1.353
diff -u -r1.352 -r1.353
--- xdebug/xdebug.c:1.352 Sat Oct 07 21:10:32 2006 GMT
+++ xdebug/xdebug.c Sun Oct 08 17:31:00 2006 GMT
@@ -704,6 +704,7 @@
         XG(prev_memory) = 0;
         XG(function_count) = 0;
         XG(active_symbol_table) = NULL;
+ XG(last_exception_trace) = NULL;
         
         if (idekey && *idekey) {
                 if (XG(ide_key)) {
@@ -808,6 +809,10 @@
                 xdfree(XG(context).list.last_file);
         }
 
+ if (XG(last_exception_trace)) {
+ xdfree(XG(last_exception_trace));
+ }
+
         /* Reset var_dump and set_time_limit to the original function */
         zend_hash_find(EG(function_table), "var_dump", 9, (void **)&orig);
         orig->internal_function.handler = XG(orig_var_dump_func);
@@ -1929,6 +1934,7 @@
         zval *message, *file, *line;
         zend_class_entry *default_ce, *exception_ce;
         xdebug_brk_info *extra_brk_info;
+ char *exception_trace;
 
         if (!exception) {
                 return;
@@ -1945,10 +1951,16 @@
         file = zend_read_property(default_ce, exception, "file", sizeof("file")-1, 0 TSRMLS_CC);
         line = zend_read_property(default_ce, exception, "line", sizeof("line")-1, 0 TSRMLS_CC);
 
+ exception_trace = get_printable_stack(PG(html_errors), exception_ce->name, Z_STRVAL_P(message), Z_STRVAL_P(file), Z_LVAL_P(line) TSRMLS_CC);
+ if (XG(last_exception_trace)) {
+ xdfree(XG(last_exception_trace));
+ }
+ XG(last_exception_trace) = exception_trace;
+
         if (XG(show_ex_trace)) {
                 log_stack(exception_ce->name, Z_STRVAL_P(message), Z_STRVAL_P(file), Z_LVAL_P(line) TSRMLS_CC);
                 if (PG(display_errors)) {
- print_stack(PG(html_errors), exception_ce->name, Z_STRVAL_P(message), Z_STRVAL_P(file), Z_LVAL_P(line) TSRMLS_CC);
+ php_printf("%s", exception_trace);
                 }
         }
 
@@ -2060,7 +2072,16 @@
         if ((EG(error_reporting) & type)) { /* Otherwise print the default stack trace */
                 log_stack(error_type_str, buffer, error_filename, error_lineno TSRMLS_CC);
                 if (PG(display_errors)) {
- print_stack(PG(html_errors), error_type_str, buffer, error_filename, error_lineno TSRMLS_CC);
+ char *printable_stack;
+
+ /* We need to see if we have an uncaught exception fatal error now */
+ if (type == E_ERROR && strncmp(buffer, "Uncaught exception", 18) == 0) {
+ php_printf("%s", XG(last_exception_trace));
+ } else {
+ printable_stack = get_printable_stack(PG(html_errors), error_type_str, buffer, error_filename, error_lineno TSRMLS_CC);
+ php_printf("%s", printable_stack);
+ xdfree(printable_stack);
+ }
                 }
         }
 
Received on Sun Oct 08 2006 - 21:31:08 BST

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