ID: 36477
Updated by: [EMAIL PROTECTED]
Reported By: ch at westend dot com
-Status: Assigned
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 5.1.2
Assigned To: dmitry
New Comment:
This is not a bug.
In your example, "exception_handler" is called not during exception
throwing, but during processing of uncought exception. So the backtrace
information is proper.
you can use Exception::getTraceAsString().
Previous Comments:
------------------------------------------------------------------------
[2006-02-21 16:02:04] ch at westend dot com
Description:
------------
After calling "throw new Exception(..)" and entering the
function registered with "set_exception_handler()" the
debug_backtrace() output is empty.
This is very inconvinient for self written error handling functions as
"trigger_error()" for example works fine for debug_backtrace.
I'm aware that the exception itself contains a stack trace
but is there really a reason to empty debug_backtrace()?
Reproduce code:
---------------
<?php
function exception_handler($e) { debug_print_backtrace(); }
function c() { throw new Exception("Problem!"); }
function b() { c(); }
function a() { b(); }
set_exception_handler('exception_handler');
a();
?>
Expected result:
----------------
Backtrace with
#1 exception_handler from c()
#2 c() from b()
#3 b() from a()
#4 a() from main
Actual result:
--------------
#0 exception_handler(Exception Object ([] => Problem!,[] => ,[] =>
0,[] => /home/ch/tt.php,[] => 5,[] => Array ([0] => Array ([file] =>
/home/ch/tt.php,[line] => 6,[function] => c,[args] => Array ()),[1] =>
Array ([file] => /home/ch/tt.php,[line] => 7,[function] => b,[args] =>
Array ()),[2] => Array ([file] => /home/ch/tt.php,[line] =>
10,[function] => a,[args] => Array ())))) called at [(null):0]
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36477&edit=1