[xdebug-dev] Bug 0000259: outputs exception backtrace even if exception is caught

From: <noreply[@]lists.xdebug.org>
Date: Wed, 25 Apr 2007 13:07:32 +0200

The following bug has been REOPENED.
======================================================================
http://bugs.xdebug.org/bug_view_page.php?bug_id=0000259
======================================================================
Reporter: aferber
Handler: derick
======================================================================
Project: Xdebug
Bug ID: 259
Category: Feature/Change request
Reproducibility: always
Severity: major
Priority: normal
Status: feedback
Operating System:
PHP Version: 5.2.1
Xdebug Version: 2.0.0rc3
======================================================================
Date Submitted: 2007-04-25 11:41 CEST
Last Modified: 2007-04-25 13:07 CEST
======================================================================
Summary: outputs exception backtrace even if exception is caught
Description:
XDebug seems to log a backtrace to the error log even if the exception is
caught and handled by the code.

This severely degrades functionality for me since for example doctrine
(which I'm using) uses exceptions internally for many things, which makes
it very difficult to distinguish those internal exceptions from the ones
that really matter (ie. uncaught exceptions).

IMHO this behaviour should be configurable, and maybe there should be a
function that can be called from exceptions handlers to log a backtrace of
the exception.
======================================================================

----------------------------------------------------------------------
 derick - 2007-04-25 11:51 CEST
----------------------------------------------------------------------
This is already configurable with the "xdebug.show_exception_trace"
setting, see the documentation at:
http://xdebug.org/docs-settings.php#show_exception_trace (and it defaults
to off). However, there have been some versions where this configuration
setting did not exist, so you might have to upgrade.

----------------------------------------------------------------------
 aferber - 2007-04-25 13:07 CEST
----------------------------------------------------------------------
The setting doesn't work for me.

I get the following behaviour for different combinations of
show_exception_trace and catching/not catching exceptions:

  1. show_exception_trace = 1
    a. uncaught: logs stack trace *twice* to httpd error log
    b. caught: logs stack trace *twice*
  2. show_exception_trace = 0
    a. uncaught: logs stack trace once
    b. caught: logs stack trace once

When using the PHP commandline version:

  1. show_exception_trace = 1
      a. uncaught: displays stack trace once
      b. caught: no stack trace
  2. show_exception_trace = 0
      a. uncaught: displays stack trace once
      b. caught: no stack trace

What I want is the behaviour of the apache module version to be the same
as the commandline version, ie. log a stack trace if an exception is not
caught.

The tests were done with the following script:

-----
echo
"xdebug.show_exception_trace=".ini_get("xdebug.show_exception_trace")."\n";
flush();
try {
    throw new Exception('test');
}
catch (Exception $e) {
    echo "Caught!\n";
}
-----

For the "uncaught" tests remove the try/catch.

This is with XDebug version 2.0.0RC3, AFAIK there is no more recent
release. PHP version is 5.2.1, however behaviour was the same with 5.1.6.
Apache is 2.0.54.

Bug History
Date Modified Username Field Change
======================================================================
2007-04-25 11:41aferber New Bug
2007-04-25 11:41aferber Bug Monitored: aferber
2007-04-25 11:51derick Bugnote Added: 0000597
2007-04-25 11:51derick Assigned To => derick
2007-04-25 11:51derick Resolution open => fixed
2007-04-25 11:51derick Status new => resolved
2007-04-25 13:07aferber Bugnote Added: 0000598
2007-04-25 13:07aferber Resolution fixed => reopened
2007-04-25 13:07aferber Status resolved => feedback
======================================================================
Received on Wed Apr 25 2007 - 13:07:34 BST

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