@@ -24,8 +24,18 @@ class B extends A {
24
24
public function func ($ str ) {
25
25
call_user_func_array (array ($ this , 'parent::func2 ' ), array ($ str ));
26
26
call_user_func_array (array ($ this , 'parent::func3 ' ), array ($ str ));
27
- call_user_func_array (array ($ this , 'parent::func22 ' ), array ($ str ));
28
- call_user_func_array (array ($ this , 'parent::inexistent ' ), array ($ str ));
27
+
28
+ try {
29
+ call_user_func_array (array ($ this , 'parent::func22 ' ), array ($ str ));
30
+ } catch (\TypeError $ e ) {
31
+ echo $ e ->getMessage () . \PHP_EOL ;
32
+ }
33
+
34
+ try {
35
+ call_user_func_array (array ($ this , 'parent::inexistent ' ), array ($ str ));
36
+ } catch (\TypeError $ e ) {
37
+ echo $ e ->getMessage () . \PHP_EOL ;
38
+ }
29
39
}
30
40
private function func2 ($ str ) {
31
41
var_dump (__METHOD__ .': ' . $ str );
@@ -45,10 +55,8 @@ $c = new C;
45
55
$ c ->func ('This should work! ' );
46
56
47
57
?>
48
- --EXPECTF --
58
+ --EXPECT --
49
59
string(27) "A::func2: This should work!"
50
60
string(27) "A::func3: This should work!"
51
-
52
- Warning: call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method A::func22() in %s on line %d
53
-
54
- Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'A' does not have a method 'inexistent' in %s on line %d
61
+ call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method A::func22()
62
+ call_user_func_array() expects parameter 1 to be a valid callback, class 'A' does not have a method 'inexistent'
0 commit comments