xref: /PHP-8.1/Zend/tests/lsb_021.phpt (revision 682e2f6c)
1--TEST--
2ZE2 Late Static Binding parent::/self:: forwarding while classname doesn't
3--FILE--
4<?php
5class A {
6    public static function test() {
7        echo get_called_class()."\n";
8    }
9}
10
11class B extends A {
12    public static function testForward() {
13        parent::test();
14        call_user_func("parent::test");
15        call_user_func(array("parent", "test"));
16        self::test();
17        call_user_func("self::test");
18        call_user_func(array("self", "test"));
19    }
20    public static function testNoForward() {
21        A::test();
22        call_user_func("A::test");
23        call_user_func(array("A", "test"));
24        B::test();
25        call_user_func("B::test");
26        call_user_func(array("B", "test"));
27
28        (self::class)::test();
29        call_user_func(self::class . "::test");
30        call_user_func(array(self::class, "test"));
31    }
32}
33
34class C extends B {
35
36}
37
38C::testForward();
39C::testNoForward();
40
41?>
42--EXPECT--
43C
44C
45C
46C
47C
48C
49A
50A
51A
52B
53B
54B
55B
56B
57B
58