The following bug has been RESOLVED.
======================================================================
http://bugs.xdebug.org/bug_view_page.php?bug_id=0000292
======================================================================
Reporter: mathieuk
Handler: derick
======================================================================
Project: Xdebug
Bug ID: 292
Category: Usage problems
Reproducibility: always
Severity: major
Priority: normal
Status: resolved
Operating System:
PHP Version: 5.2.1
Xdebug Version: 2.0.0rc4
Resolution: not a bug
======================================================================
Date Submitted: 2007-07-12 08:13 CEST
Last Modified: 2007-07-14 15:54 CEST
======================================================================
Summary: xdebug doesn't provide a stacktrace after an uncaught exception
Description:
<?php
function test()
{
throw new exception();
}
test();
?>
Consider the following code and a debugging session that has an exception
breakpoint set on "Fatal error":
<?php
function test()
{
throw new exception();
}
test();
?>
Expected behaviour:
===============================
An uncaught exception triggers a fatal error, which is caught as a
breakpoint by Xdebug. Xdebug transfers control over to the client. When
the client asks for a stacktrace using the DBGp command 'stack_get', the
user gets back a proper DBGp response, containing a stacktrace containing
entries for the function 'test' and the function '{main}'.
Actual behaviour in 2.0RC4
===============================
The uncaught exception indeed triggers a fatal error which is properly
caught by Xdebug. When requesting the stacktrace (without a depth
specificier) you get an empty response:
(cmd) stack_get -i waa3
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get"
transaction_
id="waa3"></response>
Full debugclient conversation:
===============================
Waiting for debug server to connect.
Connect
<?xml version="1.0" encoding="iso-8859-1"?>
<init xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
fileuri="file:///C%3A%5CProgram%20Fi
les%5Cxampp%5Cxampp%5Chtdocs%5Cxdebug%5Cexception.php" language="PHP"
protocol_version="1.0" appid="424" idekey="0"><eng
ine
version="2.0.0RC4-dev"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick
Rethans]]></author><url><![CDATA[http://xd
ebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2007 by Derick
Rethans]]></copyright></init>
(cmd) breakpoint_set -i waa0 -t exception -x "Fatal error"
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set"
transac
tion_id="waa0" id="4240002"></response>
(cmd) run -i waa
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run"
transaction_id="wa
a" status="break" reason="ok"><xdebug:message filename="C:\Program
Files\xampp\xampp\htdocs\xdebug\exception.php" lineno
="5" exception="Fatal error"><![CDATA[Uncaught exception 'Exception' in
C:\Program Files\xampp\xampp\htdocs\xdebug\excep
tion.php:5
Stack trace:
http://bugs.xdebug.org/bug_view_page.php?bug_id=0000000 C:\Program Files\xampp\xampp\htdocs\xdebug\exception.php(8): test()
http://bugs.xdebug.org/bug_view_page.php?bug_id=0000001 {main}
thrown]]></xdebug:message></response>
(cmd) stack_get -i waa3
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get"
transaction_
id="waa3"></response>
(cmd) stack_get -i waa4 -d 0
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get"
transaction_
id="waa4"><error code="1"><message><![CDATA[parse error in
command]]></message></error></response>
(cmd) stack_get -i waa5 -d 1
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get"
transaction_
id="waa4" status="break" reason="ok"><error
code="301"><message><![CDATA[stack depth
invalid]]></message></error></respo
nse>
======================================================================
----------------------------------------------------------------------
derick - 2007-07-14 15:54 CEST
----------------------------------------------------------------------
This is not a bug. The uncaught fatal error happens after PHP wind down all
the stack to find a matching catch block. If it can't find one it's
basically back to stack level -1, which is even before the script starts.
There is nothing that Xdebug can do about this.
It works for just showing the uncaught exception stack trace because
Xdebug keeps internally a full stack in a formatted message for every
exception.
Bug History
Date Modified Username Field Change
======================================================================
2007-07-12 08:13mathieuk New Bug
2007-07-12 08:13mathieuk Bug Monitored: mathieuk
2007-07-14 15:54derick Bugnote Added: 0000692
2007-07-14 15:54derick Assigned To => derick
2007-07-14 15:54derick Resolution open => not a bug
2007-07-14 15:54derick Status new => resolved
======================================================================
Received on Sat Jul 14 2007 - 15:54:08 BST
This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST