xref: /PHP-7.4/Zend/tests/bug45186_2.phpt (revision 782352c5)
1--TEST--
2Bug #45186.2 (__call depends on __callstatic in class scope)
3--FILE--
4<?php
5
6class bar  {
7	public function __call($a, $b) {
8		print "__call:\n";
9		var_dump($a);
10	}
11	public function test() {
12		self::ABC();
13		bar::ABC();
14		call_user_func(array('BAR', 'xyz'));
15		call_user_func('BAR::www');
16		call_user_func(array('self', 'y'));
17		call_user_func('self::y');
18	}
19	static function x() {
20		print "ok\n";
21	}
22}
23
24$x = new bar;
25
26$x->test();
27
28call_user_func(array('BAR','x'));
29call_user_func('BAR::www');
30call_user_func('self::y');
31
32?>
33--EXPECTF--
34__call:
35string(3) "ABC"
36__call:
37string(3) "ABC"
38__call:
39string(3) "xyz"
40__call:
41string(3) "www"
42__call:
43string(1) "y"
44__call:
45string(1) "y"
46ok
47
48Warning: call_user_func() expects parameter 1 to be a valid callback, class 'bar' does not have a method 'www' in %s on line %d
49
50Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access self:: when no class scope is active in %sbug45186_2.php on line 27
51