xref: /PHP-8.3/Zend/tests/bug30828.phpt (revision de6e401e)
1--TEST--
2Bug #30828 (debug_backtrace() reports incorrect class in overridden methods)
3--FILE--
4<?php
5class A {
6    function __construct() {
7        debug_print_backtrace();
8        $bt = debug_backtrace();
9        foreach ($bt as $t) {
10            print $t['class'].$t['type'].$t['function']."\n";
11        }
12    }
13
14    function foo() {
15        debug_print_backtrace();
16        $bt = debug_backtrace();
17        foreach ($bt as $t) {
18                        print $t['class'].$t['type'].$t['function']."\n";
19        }
20    }
21
22    static function bar() {
23        debug_print_backtrace();
24        $bt = debug_backtrace();
25        foreach ($bt as $t) {
26            print $t['class'].$t['type'].$t['function']."\n";
27        }
28    }
29}
30
31class B extends A {
32    function __construct() {
33        parent::__construct();
34    }
35
36    function foo() {
37        parent::foo();
38    }
39
40    static function bar() {
41        parent::bar();
42    }
43}
44
45$b = new B();
46$b->foo();
47B::bar();
48?>
49--EXPECTF--
50#0 %sbug30828.php(30): A->__construct()
51#1 %sbug30828.php(42): B->__construct()
52A->__construct
53B->__construct
54#0 %sbug30828.php(34): A->foo()
55#1 %sbug30828.php(43): B->foo()
56A->foo
57B->foo
58#0 %sbug30828.php(38): A::bar()
59#1 %sbug30828.php(44): B::bar()
60A::bar
61B::bar
62