xref: /PHP-7.3/Zend/tests/bug45180.phpt (revision b746e698)
1--TEST--
2Testing callback formats within class method
3--FILE--
4<?php
5
6class foo {
7	public function test() {
8		call_user_func(array('FOO', 'ABC'));
9		call_user_func(array($this, 'ABC'));
10		foo::XYZ();
11		self::WWW();
12		call_user_func('FOO::ABC');
13	}
14	function __call($a, $b) {
15		print "__call:\n";
16		var_dump($a);
17	}
18	static public function __callStatic($a, $b) {
19		print "__callstatic:\n";
20		var_dump($a);
21	}
22}
23
24$x = new foo;
25
26$x->test();
27
28$x::A();
29
30foo::B();
31
32$f = 'FOO';
33
34$f::C();
35
36$f::$f();
37
38foo::$f();
39
40?>
41--EXPECT--
42__call:
43string(3) "ABC"
44__call:
45string(3) "ABC"
46__call:
47string(3) "XYZ"
48__call:
49string(3) "WWW"
50__call:
51string(3) "ABC"
52__callstatic:
53string(1) "A"
54__callstatic:
55string(1) "B"
56__callstatic:
57string(1) "C"
58__callstatic:
59string(3) "FOO"
60__callstatic:
61string(3) "FOO"
62