xref: /PHP-7.0/Zend/tests/bug30828.phpt (revision 610c7fbe)
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  A->__construct() called at [%sbug30828.php:30]
51#1  B->__construct() called at [%sbug30828.php:42]
52A->__construct
53B->__construct
54#0  A->foo() called at [%sbug30828.php:34]
55#1  B->foo() called at [%sbug30828.php:43]
56A->foo
57B->foo
58#0  A::bar() called at [%sbug30828.php:38]
59#1  B::bar() called at [%sbug30828.php:44]
60A::bar
61B::bar
62