xref: /PHP-7.4/Zend/tests/bug48770_3.phpt (revision 782352c5)
1--TEST--
2Bug #48770 (call_user_func_array() fails to call parent from inheriting class)
3--XFAIL--
4See Bug #48770
5--FILE--
6<?php
7
8class A {
9	public function func($str) {
10		var_dump(__METHOD__ .': '. $str);
11	}
12	private function func2($str) {
13		var_dump(__METHOD__ .': '. $str);
14	}
15	protected function func3($str) {
16		var_dump(__METHOD__ .': '. $str);
17	}
18	private function func22($str) {
19		var_dump(__METHOD__ .': '. $str);
20	}
21}
22
23class B extends A {
24	public function func($str) {
25  		call_user_func_array(array($this, 'self::func2'), array($str));
26  		call_user_func_array(array($this, 'self::func3'), array($str));
27  		call_user_func_array(array($this, 'self::inexistent'), array($str));
28	}
29	private function func2($str) {
30		var_dump(__METHOD__ .': '. $str);
31	}
32	protected function func3($str) {
33		var_dump(__METHOD__ .': '. $str);
34	}
35}
36
37class C extends B {
38	public function func($str) {
39		parent::func($str);
40	}
41}
42
43$c = new C;
44$c->func('This should work!');
45
46?>
47--EXPECTF--
48string(27) "B::func2: This should work!"
49string(27) "B::func3: This should work!"
50
51Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'B' does not have a method 'inexistent' in %s on line %d
52