php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30828 debug_backtrace() reports incorrect class in overridden methods
Submitted: 2004-11-18 16:32 UTC Modified: 2005-06-23 11:25 UTC
Votes:8
Avg. Score:3.9 ± 1.5
Reproduced:7 of 8 (87.5%)
Same Version:2 (28.6%)
Same OS:3 (42.9%)
From: lists at infospleen dot com Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2005-06-19 OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lists at infospleen dot com
New email:
PHP Version: OS:

 

 [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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-07 13:39 UTC] 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'.
 [2005-06-23 11:25 UTC] dmitry@php.net
Fixed in CVS HEAD and PHP_5_0.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 13:01:29 2024 UTC