@@ -24,8 +24,18 @@ class B extends A {
2424 public function func ($ str ) {
2525 call_user_func_array (array ($ this , 'parent::func2 ' ), array ($ str ));
2626 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+ }
2939 }
3040 private function func2 ($ str ) {
3141 var_dump (__METHOD__ .': ' . $ str );
@@ -45,10 +55,8 @@ $c = new C;
4555$ c ->func ('This should work! ' );
4656
4757?>
48- --EXPECTF --
58+ --EXPECT --
4959string(27) "A::func2: This should work!"
5060string(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