xref: /PHP-8.1/Zend/tests/bug66719.phpt (revision dfd05da9)
1--TEST--
2Bug #66719: Weird behaviour when using get_called_class() with call_user_func()
3--FILE--
4<?php
5
6class A
7{
8    public static function who()
9    {
10        var_dump(get_called_class());
11    }
12}
13class B extends A
14{
15    public static function who()
16    {
17        parent::who();
18    }
19}
20
21class C
22{
23    public static function test() {
24        B::who();
25        call_user_func(array(A::class, 'who'));
26        call_user_func(array(B::class, 'parent::who'));
27    }
28}
29
30B::who();
31call_user_func(array(A::class, 'who'));
32call_user_func(array(B::class, 'parent::who'));
33
34C::test();
35
36?>
37--EXPECT--
38string(1) "B"
39string(1) "A"
40string(1) "A"
41string(1) "B"
42string(1) "A"
43string(1) "A"
44