|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-07-21 07:46 UTC] roborg at gmail dot com
-PHP Version: Irrelevant
+PHP Version: 7.0.0beta1
[2015-07-21 07:46 UTC] roborg at gmail dot com
[2016-04-12 17:50 UTC] krakjoe@php.net
[2016-04-12 17:50 UTC] krakjoe@php.net
-Status: Open
+Status: Suspended
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 00:00:02 2025 UTC |
Description: ------------ The backtrace (either from an exception or debug_backtrace) doesn't contain an entry for the class of the object that a method was called on - only the class that the method was defined in. In the example below, there's even though the call is on a B object, there's no mention of B in the backtrace, which cane make debugging very difficult. I would suggest adding an extra item to the trace, e.g. "object_class", alongside class. Test script: --------------- <?php class A { protected $val = 0; public function ex() { throw new Exception('Value is ' . $this->val); } } class B extends A { protected $val = 1; } try { $b = new B(); $b->ex(); } catch (Exception $e) { print '<pre>' . print_r($e->getTrace(), true) . '</pre>'; } Expected result: ---------------- Array ( [0] => Array ( [file] => C:\bug.php [line] => 21 [function] => ex [class] => A [object_class] => B [type] => -> [args] => Array ( ) ) ) Actual result: -------------- Array ( [0] => Array ( [file] => C:\bug.php [line] => 21 [function] => ex [class] => A [type] => -> [args] => Array ( ) ) )