View Issue Details

IDProjectCategoryView StatusLast Update
0001188XdebugUncategorizedpublic2015-10-22 22:58
ReporterStrate Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionno change required 
Product Version2.3.2 
Summary0001188: Improve stacktraces inside catch blocks
Description

Try to debug this code:

<?php

function a() {
b();
}

function b() {
c();
}

function c() {
throw new \Exception();
}

try {
a();
} catch (\Exception $e) {
xdebug_break();
}

Open this code in IDE, i.e. PhpStorm put breakpoint to xdebug_break(); statement, and run script. On script breaks, try to look to stacktrace. You will see only main() call (see attached screenshot). But real stacktrace is:

  • xdebug_trace.php:16 (call to function a)
  • xdebug_trace.php:4 (call to function b)
  • xdebug_trace.php:8 (call to function c)
  • xdebug_trace.php:12 (throwing new exception in function c)
  • xdebug)trace.php:18 (catching thac exception)

It would be great improvement, if caught stacktrace be closer to real stack trace

TagsNo tags attached.
Operating SystemLinux
PHP Version5.6.10-5.6.14

Activities

derick

2015-10-22 22:58

administrator   ~0003184

At the moment your exception is caught, the whole stack has been rolled up already. That means that because it's not there, we can't show it any more.

If you want to see the full stack when an exception gets thrown in PHP Storm, set an Exception break point on "Exception" or "*".