[xdebug-dev] Bug 0000292: xdebug doesn't provide a stacktrace after an uncaught exception

From: <noreply[@]lists.xdebug.org>
Date: Thu, 12 Jul 2007 08:13:23 +0200

The following NEW bug has been ADDED.
======================================================================
http://bugs.xdebug.org/bug_view_page.php?bug_id=0000292
======================================================================
Reporter: mathieuk
Handler:
======================================================================
Project: Xdebug
Bug ID: 292
Category: Usage problems
Reproducibility: always
Severity: major
Priority: normal
Status: new
Operating System:
PHP Version: 5.2.1
Xdebug Version: 2.0.0rc4
======================================================================
Date Submitted: 2007-07-12 08:13 CEST
Last Modified: 2007-07-12 08:13 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>

======================================================================

Bug History
Date Modified Username Field Change
======================================================================
2007-07-12 08:13mathieuk New Bug
2007-07-12 08:13mathieuk Bug Monitored: mathieuk
======================================================================
Received on Thu Jul 12 2007 - 08:13:27 BST

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