1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 02:33:17 +02:00
Files
DanielEScherzer 618190127e Zend/tests: organize some tests with sub directories (8) (#17873)
Create new sub directories for tests related to backtraces and for tests
related to `$this` being reserved in different places and not being usable or
reassignable.

Work towards GH-15631
2025-02-22 19:10:59 +00:00

62 lines
1.2 KiB
PHP

--TEST--
Bug #30828 (debug_backtrace() reports incorrect class in overridden methods)
--FILE--
<?php
class A {
function __construct() {
debug_print_backtrace();
$bt = debug_backtrace();
foreach ($bt as $t) {
print $t['class'].$t['type'].$t['function']."\n";
}
}
function foo() {
debug_print_backtrace();
$bt = debug_backtrace();
foreach ($bt as $t) {
print $t['class'].$t['type'].$t['function']."\n";
}
}
static function bar() {
debug_print_backtrace();
$bt = debug_backtrace();
foreach ($bt as $t) {
print $t['class'].$t['type'].$t['function']."\n";
}
}
}
class B extends A {
function __construct() {
parent::__construct();
}
function foo() {
parent::foo();
}
static function bar() {
parent::bar();
}
}
$b = new B();
$b->foo();
B::bar();
?>
--EXPECTF--
#0 %sbug30828.php(30): A->__construct()
#1 %sbug30828.php(42): B->__construct()
A->__construct
B->__construct
#0 %sbug30828.php(34): A->foo()
#1 %sbug30828.php(43): B->foo()
A->foo
B->foo
#0 %sbug30828.php(38): A::bar()
#1 %sbug30828.php(44): B::bar()
A::bar
B::bar