xref: /PHP-7.4/Zend/tests/objects_025.phpt (revision 782352c5)
1--TEST--
2Testing invalid method names with __call and __callstatic
3--FILE--
4<?php
5
6class foo {
7	public function __call($a, $b) {
8		print "non-static - ok\n";
9	}
10
11	public static function __callstatic($a, $b) {
12		print "static - ok\n";
13	}
14}
15
16$a = new foo;
17$a->foooo();
18$a::foooo();
19
20$b = 'aaaaa1';
21$a->$b();
22$a::$b();
23
24$b = '  ';
25$a->$b();
26$a::$b();
27
28$b = str_repeat('a', 10000);
29$a->$b();
30$a::$b();
31
32$b = NULL;
33$a->$b();
34
35?>
36--EXPECTF--
37non-static - ok
38static - ok
39non-static - ok
40static - ok
41non-static - ok
42static - ok
43non-static - ok
44static - ok
45
46Fatal error: Uncaught Error: Method name must be a string in %s:%d
47Stack trace:
48#0 {main}
49  thrown in %s on line %d
50