From 1482e13742d700f931067b39ab513f931d13d9aa Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 5 Feb 2020 21:22:49 +0100 Subject: [PATCH 1/2] Adjust test to TypeError --- Zend/tests/bug48770_2.phpt | 22 +++++++++++++++------- Zend/tests/bug48770_3.phpt | 14 ++++++++------ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Zend/tests/bug48770_2.phpt b/Zend/tests/bug48770_2.phpt index 3666ebc9cef32..d94ae1b217462 100644 --- a/Zend/tests/bug48770_2.phpt +++ b/Zend/tests/bug48770_2.phpt @@ -24,8 +24,18 @@ class B extends A { public function func($str) { call_user_func_array(array($this, 'parent::func2'), array($str)); call_user_func_array(array($this, 'parent::func3'), array($str)); - call_user_func_array(array($this, 'parent::func22'), array($str)); - call_user_func_array(array($this, 'parent::inexistent'), array($str)); + + try { + call_user_func_array(array($this, 'parent::func22'), array($str)); + } catch (\TypeError $e) { + echo $e->getMessage() . \PHP_EOL; + } + + try { + call_user_func_array(array($this, 'parent::inexistent'), array($str)); + } catch (\TypeError $e) { + echo $e->getMessage() . \PHP_EOL; + } } private function func2($str) { var_dump(__METHOD__ .': '. $str); @@ -45,10 +55,8 @@ $c = new C; $c->func('This should work!'); ?> ---EXPECTF-- +--EXPECT-- string(27) "A::func2: This should work!" string(27) "A::func3: This should work!" - -Warning: call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method A::func22() in %s on line %d - -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 +call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method A::func22() +call_user_func_array() expects parameter 1 to be a valid callback, class 'A' does not have a method 'inexistent' diff --git a/Zend/tests/bug48770_3.phpt b/Zend/tests/bug48770_3.phpt index 0b5150d5188e3..5fcf9f2aed513 100644 --- a/Zend/tests/bug48770_3.phpt +++ b/Zend/tests/bug48770_3.phpt @@ -1,7 +1,5 @@ --TEST-- Bug #48770 (call_user_func_array() fails to call parent from inheriting class) ---XFAIL-- -See Bug #48770 --FILE-- getMessage() . \PHP_EOL; + } } private function func2($str) { var_dump(__METHOD__ .': '. $str); @@ -44,8 +47,7 @@ $c = new C; $c->func('This should work!'); ?> ---EXPECTF-- +--EXPECT-- string(27) "B::func2: This should work!" string(27) "B::func3: This should work!" - -Warning: 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 +call_user_func_array() expects parameter 1 to be a valid callback, class 'B' does not have a method 'inexistent' From dcafafc58de820dfc2efca6279a72cee82b3ed80 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 5 Feb 2020 22:59:25 +0100 Subject: [PATCH 2/2] Readd XFAIL --- Zend/tests/bug48770_3.phpt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Zend/tests/bug48770_3.phpt b/Zend/tests/bug48770_3.phpt index 5fcf9f2aed513..cbd74df25a268 100644 --- a/Zend/tests/bug48770_3.phpt +++ b/Zend/tests/bug48770_3.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #48770 (call_user_func_array() fails to call parent from inheriting class) +--XFAIL-- +See Bug #48770 --FILE--