php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39111 debug_backtrace() has problems with static classes
Submitted: 2006-10-10 12:15 UTC Modified: 2006-10-10 14:00 UTC
From: vincent dot guth at gmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.1.6 OS: *
Private report: No CVE-ID: None
 [2006-10-10 12:15 UTC] vincent dot guth at gmail dot com
Description:
------------
The "class" parameter should be "B" instead of "A", as I called B::r() and not A::r().

Reproduce code:
---------------
<?php
abstract class A {
	public static function r() {
		var_dump(debug_backtrace());
	}
}

class B extends A {

}

echo B::r();
?>

Expected result:
----------------
array(1) {
  [0]=>
  array(6) {
    ["file"]=>
    string(13) "/www/test.php"
    ["line"]=>
    int(12)
    ["function"]=>
    string(1) "r"
    ["class"]=>
    string(1) "B" /* Not A */
    ["type"]=>
    string(2) "::"
    ["args"]=>
    array(0) {
    }
  }
}

Actual result:
--------------
array(1) {
  [0]=>
  array(6) {
    ["file"]=>
    string(13) "/www/test.php"
    ["line"]=>
    int(12)
    ["function"]=>
    string(1) "r"
    ["class"]=>
    string(1) "A"
    ["type"]=>
    string(2) "::"
    ["args"]=>
    array(0) {
    }
  }
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-10 14:00 UTC] tony2001@php.net
The function r() belongs to class A and is executed in its scope, so the result you get is expected.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 07 21:01:30 2024 UTC