xref: /PHP-8.1/Zend/tests/bug42937.phpt (revision d30cd7d7)
1--TEST--
2Bug #42937 (__call() method not invoked when methods are called on parent from child class)
3--FILE--
4<?php
5class A {
6    function __call($strMethod, $arrArgs) {
7        echo "$strMethod\n";
8    }
9}
10
11class C {
12    function __call($strMethod, $arrArgs) {
13        echo "$strMethod\n";
14    }
15}
16
17class B extends A {
18    function test() {
19        self::test1();
20        parent::test2();
21        static::test3();
22        A::test4();
23        B::test5();
24        C::test6();
25    }
26}
27
28$a = new A();
29$a->test();
30
31$b = new B();
32$b->test();
33?>
34--EXPECTF--
35test
36test1
37test2
38test3
39test4
40test5
41
42Fatal error: Uncaught Error: Call to undefined method C::test6() in %s:%d
43Stack trace:
44#0 %s(%d): B->test()
45#1 {main}
46  thrown in %sbug42937.php on line 21
47