|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-11-18 16:32 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 20:00:01 2025 UTC |
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'.