[xdebug-dev] xdebug xdebug/xdebug.c - Fixed bug #243: show_exception_trace="0" ignored.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Wed, 28 Feb 2007 20:44:32 +0100

Date: Wed Feb 28 20:44:32 CET 2007
User: Derick Rethans
Directory: xdebug

Log Message:
[1.00]
- Fixed bug #243: show_exception_trace="0" ignored.
- Fixed a segfault in rendering stack traces to error logs.

Modified files:
           xdebug/xdebug.c (version: 1.374)

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.373
retrieving revision 1.374
diff -u -r1.373 -r1.374
--- xdebug/xdebug.c:1.373 Mon Feb 26 13:43:30 2007 GMT
+++ xdebug/xdebug.c Wed Feb 28 18:44:32 2007 GMT
@@ -1671,8 +1671,17 @@
         int is_cli = (strcmp("cli", sapi_module.name) == 0);
         xdebug_llist_element *le;
         function_stack_entry *i;
+ char *tmp_log_message;
 
- if (PG(log_errors) && !is_cli && XG(stack) && XG(stack)->size) {
+ if (is_cli) {
+ return;
+ }
+
+ tmp_log_message = xdebug_sprintf( "PHP %s: %s in %s on line %d", error_type_str, buffer, error_filename, error_lineno);
+ php_log_err(tmp_log_message TSRMLS_CC);
+ xdfree(tmp_log_message);
+
+ if (XG(stack) && XG(stack)->size) {
                 php_log_err("PHP Stack trace:" TSRMLS_CC);
 
                 for (le = XDEBUG_LLIST_HEAD(XG(stack)); le != NULL; le = XDEBUG_LLIST_NEXT(le))
@@ -1697,11 +1706,16 @@
                                         c = 1;
                                 }
                                 tmp_varname = i->var[j].name ? xdebug_sprintf("$%s = ", i->var[j].name) : xdstrdup("");
- tmp_value = xdebug_get_zval_value(i->var[j].addr, 0, NULL);
                                 xdebug_str_add(&log_buffer, tmp_varname, 0);
- xdebug_str_add(&log_buffer, tmp_value, 0);
                                 xdfree(tmp_varname);
- xdfree(tmp_value);
+
+ if (i->var[j].addr) {
+ tmp_value = xdebug_get_zval_value(i->var[j].addr, 0, NULL);
+ xdebug_str_add(&log_buffer, tmp_value, 0);
+ xdfree(tmp_value);
+ } else {
+ xdebug_str_addl(&log_buffer, "*uninitialized*", 15, 0);
+ }
                         }
 
                         xdebug_str_add(&log_buffer, xdebug_sprintf(") %s:%d", i->filename, i->lineno), 1);
@@ -1719,8 +1733,6 @@
         char **formats;
         xdebug_str str = {0, 0, NULL};
 
- log_stack(error_type_str, buffer, error_filename, error_lineno TSRMLS_CC);
-
         if (html) {
                 formats = html_formats;
         } else {
@@ -2047,7 +2059,9 @@
         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(log_errors)) {
+ log_stack(exception_ce->name, Z_STRVAL_P(message), Z_STRVAL_P(file), Z_LVAL_P(line) TSRMLS_CC);
+ }
                 if (PG(display_errors)) {
                         php_printf("%s", exception_trace);
                 }
@@ -2145,21 +2159,20 @@
         }
 #endif
 
- /* Log to logger */
- if (PG(log_errors) && (EG(error_reporting) & type)) {
- char log_buffer[1024];
+ if (EG(error_reporting) & type) {
+ /* Log to logger */
+ if (PG(log_errors)) {
+ char log_buffer[1024];
 
 #ifdef PHP_WIN32
- if (type==E_CORE_ERROR || type==E_CORE_WARNING) {
- MessageBox(NULL, buffer, error_type_str, MB_OK|ZEND_SERVICE_MB_STYLE);
- }
+ if (type==E_CORE_ERROR || type==E_CORE_WARNING) {
+ MessageBox(NULL, buffer, error_type_str, MB_OK|ZEND_SERVICE_MB_STYLE);
+ }
 #endif
- snprintf(log_buffer, 1024, "PHP %s: %s in %s on line %d", error_type_str, buffer, error_filename, error_lineno);
- php_log_err(log_buffer TSRMLS_CC);
- }
+ log_stack(error_type_str, buffer, error_filename, error_lineno TSRMLS_CC);
+ }
 
- if ((EG(error_reporting) & type)) { /* Otherwise print the default stack trace */
- log_stack(error_type_str, buffer, error_filename, error_lineno TSRMLS_CC);
+ /* Display errors */
                 if (PG(display_errors)) {
                         char *printable_stack;
 
Received on Wed Feb 28 2007 - 20:44:34 GMT

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