View Issue Details

IDProjectCategoryView StatusLast Update
0000450XdebugUncategorizedpublic2020-12-11 16:33
ReporterFreeaqingme Assigned Toderick  
PrioritynormalSeverityfeatureReproducibilityalways
Status acknowledgedResolutionopen 
Product Version2.0.0dev 
Summary0000450: "Incomplete" backtraces when an exception gets rethrown
DescriptionTry the attached 'script'. I would have liked to know the exception was thrown in f6() however, unfortunately xdebug does show no more steps after f4(). This on itself is fairly well explainable, if it were not for php (without xdebug) to actually do show the exception was thrown in f6().

php version: 5.2.9, xdebug version 2.0.4
Additional Information<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
class test {
        function f4() {
                try {
                        $this->f5();
                } catch(exception $e) {
                        throw $e;
                }
        }

        function f5() {
                $this->f6();
        }

        function f6() {
                throw new exception('foo');
        }
}

$test = new test();

$test->f4();
?>
TagsNo tags attached.
Operating SystemGNU Linux
PHP Version5.2.8

Relationships

has duplicate 0001298 resolvedderick Incomplete stack trace when re-throwing exception 

Activities

derick

2016-12-13 21:38

administrator   ~0004054

This is likely going to be difficult to fix.

AndreKR

2020-12-11 16:33

reporter   ~0005586

> This is likely going to be difficult to fix.

Why would that be? The information *is* in the Exception, it can be shown from within PHP with `$e->getTrace()`. Xdebug cannot access it?

In fact, my long time workaround for this issue is:
```php
// Re-throw the exception
if (!extension_loaded('xdebug'))
  throw $e;
else
  throw new Exception(null, null, $e);
```
*Then* Xdebug does show the stack trace of the exception *in addition* to the (usually useless) stack trace of the re-throw.

Issue History

Date Modified Username Field Change
2009-07-03 18:58 Freeaqingme New Issue
2009-07-03 18:58 Freeaqingme Operating System => GNU Linux
2009-07-03 18:58 Freeaqingme PHP Version => 5.2.8
2009-07-03 18:58 Freeaqingme Xdebug Version => 2.0.4-dev
2016-12-11 23:50 derick Relationship added has duplicate 0001298
2016-12-13 21:38 derick Note Added: 0004054
2016-12-13 21:38 derick Assigned To => derick
2016-12-13 21:38 derick Status new => acknowledged
2020-03-12 16:55 derick Severity tweak => feature
2020-03-12 17:01 derick Category Feature/Change request => Uncategorized
2020-12-11 16:33 AndreKR Note Added: 0005586