xref: /PHP-7.0/Zend/tests/bug48770.phpt (revision d49b4fa5)
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		static $avoid_crash = 0;
26
27		if ($avoid_crash++ == 1) {
28			print "This method shouldn't be called when using parent::func!\n";
29			return;
30		}
31
32		call_user_func_array(array($this, 'parent::func'), array($str));
33	}
34	private function func2($str) {
35		var_dump(__METHOD__ .': '. $str);
36	}
37	protected function func3($str) {
38		var_dump(__METHOD__ .': '. $str);
39	}
40}
41
42class C extends B {
43	public function func($str) {
44		parent::func($str);
45	}
46}
47
48$c = new C;
49$c->func('This should work!');
50
51?>
52--EXPECTF--
53%unicode|string%(26) "A::func: This should work!"
54