[2008年06月24日 20:23 UTC] lasse100 at planet dot nl
Description: ------------ As in function debug_backtrace(), the method Exception::getTrace() should return a array with a 'object' element, representing the current object. The method Exception::getTrace() should also have a $provide_object parameter like the parameter in function debug_backtrace(), to disable the 'object'-element in the array. Reproduce code: --------------- <?php class Foo { public $bar; public function __construct($bar) { $this->bar = $bar; echo 'debug_backtrace: <pre>'; var_dump(debug_backtrace()); echo '</pre>'; throw new Exception('Foo throws an exception!'); } } try { $foo = new Foo('test'); } catch (Exception $e) { echo 'Exception::getTrace(): <pre>'; var_dump($e->getTrace()); echo '</pre>'; } ?> Expected result: ---------------- debug_backtrace: array(1) { [0]=> array(7) { ["file"]=> string(50) "C:\server\apache\htdocs\forum\htdocs\bugreport.php" ["line"]=> int(13) ["function"]=> string(11) "__construct" ["class"]=> string(3) "Foo" ["object"]=> object(Foo)#1 (1) { ["bar"]=> string(4) "test" } ["type"]=> string(2) "->" ["args"]=> array(1) { [0]=> &string(4) "test" } } } Exception::getTrace(): array(1) { [0]=> array(6) { ["file"]=> string(50) "C:\server\apache\htdocs\forum\htdocs\bugreport.php" ["line"]=> int(13) ["function"]=> string(11) "__construct" ["class"]=> string(3) "Foo" ["object"]=> object(Foo)#1 (1) { ["bar"]=> string(4) "test" } ["type"]=> string(2) "->" ["args"]=> array(1) { [0]=> string(4) "test" } } } Actual result: -------------- debug_backtrace: array(1) { [0]=> array(7) { ["file"]=> string(50) "C:\server\apache\htdocs\forum\htdocs\bugreport.php" ["line"]=> int(13) ["function"]=> string(11) "__construct" ["class"]=> string(3) "Foo" ["object"]=> object(Foo)#1 (1) { ["bar"]=> string(4) "test" } ["type"]=> string(2) "->" ["args"]=> array(1) { [0]=> &string(4) "test" } } } Exception::getTrace(): array(1) { [0]=> array(6) { ["file"]=> string(50) "C:\server\apache\htdocs\forum\htdocs\bugreport.php" ["line"]=> int(13) ["function"]=> string(11) "__construct" ["class"]=> string(3) "Foo" ["type"]=> string(2) "->" ["args"]=> array(1) { [0]=> string(4) "test" } } } PatchesException_getTrace_object_property (last revision 2010年06月13日 08:43 UTC by jille at quis dot cx)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010年12月20日 09:18 UTC] jani@php.net
-Package: Feature/Change Request
+Package: Scripting Engine problem
[2010年12月20日 09:18 UTC] jani@php.net
-Operating System: Irrelevant
+Operating System: *
[2012年08月16日 07:38 UTC] jachym dot tousek at gmail dot com
[2013年01月04日 19:38 UTC] lstrojny@php.net
[2013年01月06日 04:17 UTC] stas@php.net
[2014年11月24日 09:43 UTC] roborg at hotmail dot com
|