#30828 [Opn->Ver]: debug_backtrace reports incorrect class in overridden methods
| From: | sniper@php.net | Date: | Sun, 27 Feb 2005 22:44:13 +0000 |
| Subject: | #30828 [Opn->Ver]: debug_backtrace reports incorrect class in overridden methods | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-74661@lists.php.net to get a copy of this message | ||
ID: 30828
Updated by: sniper@php.net
Reported By: lists at infospleen dot com
-Status: Open
+Status: Verified
-Bug Type: Scripting Engine problem
+Bug Type: Zend Engine 2 problem
-Operating System:
+Operating System: *
-PHP Version: 5.0.1
+PHP Version: 5CVS-2005-02-28
Previous Comments:
------------------------------------------------------------------------
[2005-01-07 13:39:43] vargusz at freemail dot hu
Possibly the same underlying code causes inherited static method calls
to be misreported:
class A {
static function f () {
$bt = debug_backtrace();
echo "{$bt['class']}\n";
}
}
class B extends A {}
And both A::f() and B::f() produce 'A'.
------------------------------------------------------------------------
[2004-11-18 16:32:47] lists at infospleen dot com
Description:
------------
If class B extends class A, and overrides a method of class A,
debug_backtrace() reports that the method of class A is a method of
class B instead.
Reproduce code:
---------------
class A {
function __construct() {
$bt = debug_backtrace();
foreach ($bt as $t)
print
$t['class'].'::'.
$t['function'].'<br>';
}
}
class B extends A {
function __construct() {
parent::__construct();
}
}
$b = new B();
Expected result:
----------------
Expected output:
A::__construct
B::__construct
Actual result:
--------------
Actual output:
B::__construct
B::__construct
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30828&edit=1