Req #69027 [NEW]: Backtrace does not include class

From: Date: Wed, 11 Feb 2015 10:20:13 +0000
Subject: Req #69027 [NEW]: Backtrace does not include class
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190579@lists.php.net to get a copy of this message
From: roborg at gmail dot com Operating system: N/A PHP version: Irrelevant Package: Unknown/Other Function Bug Type: Feature/Change Request Bug description:Backtrace does not include class 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 ( ) ) ) -- Edit bug report at https://bugs.php.net/bug.php?id=69027&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69027&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69027&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69027&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69027&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69027&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69027&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69027&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69027&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69027&r=support Expected behavior: https://bugs.php.net/fix.php?id=69027&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69027&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69027&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69027&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69027&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69027&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69027&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69027&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69027&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69027&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69027&r=mysqlcfg

« previous php.bugs (#190579) next »