# debug_backtrace and static methods.

- Thread: https://externals.io/message/13857
- Original archive: https://news-web.php.net/php.internals/13857
- Started by Jason Sweat on 2004-11-15T02:28:31+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #13857 — Jason Sweat — 2004-11-15T02:28:31+00:00

URL: https://externals.io/message/13857#13857

I am not sure if this should be considered a bug. If it should be, I
would be happy to report it.  I did a search for debug_backtrace and
static and found no hits in the bug database.

If you call a static method from inside of another classes method,
debug_backtrace reports the calls as being a method of the hosting
object's class, not the static call.  IMO, it should still be reported
as a static function call, even if it happens to be invoked from
within a class.  Here is a simple test case:

class S {
        function bt() {
                $bt = `debug_backtrace()`;
                echo $bt[0]['class'], $bt[0]['type'], $bt[0]['function'], "\n";
        }
}
class C extends S {}
class O {
        function t() {
                S::bt(); 
        }
}

//okay S::bt
S::bt();

//also okay C->bt
$o = new C;
$o->bt();

// problem?  reports O->bt, but I think it should have been S::bt
$o2 = new O;
$o2->t();

Is this perhaps caused by confusion related to the scope resolution
operator between the static call, and trying to resolve parent::
inheritance?

Regards,
Jason
-- 
http://blog.casey-sweat.us/
