From d9db5d5487dcb6b0e6d522063bcae7b48bd6afa8 Mon Sep 17 00:00:00 2001 From: Alex Dowad Date: Tue, 14 Apr 2020 14:05:32 +0200 Subject: [PATCH] Remove XFAIL from tests for 'bug' 48770 Bug 48770 was opened due to conflicting expectations about the behavior of: call_user_func_array(array($this, 'parent::methodName'), array($arg1,$arg2)) The one reporting the 'bug' seemed to think that since the method name was prefixed with `parent::`, it should call the method in the superclass of the *class where this code appears*. However, `$this` might be an instance of a subclass. If so, then it is quite reasonable that `call_user_func_array` will call the method as defined in the superclass of *the receiver*. So the 'bug' is not really a bug. Therefore, there is no need for an XFAIL in the tests. They should just pass. Amend tests to reflect the actual expected behavior of `call_user_func_array`, not what the person who reported bug 48770 thought it should be. The fact that the PHP interpreter crashes with an error message on the test code is not really an issue either. The test code is essentially no different from: function infinite_loop() { infinite_loop(); } infinite_loop(); If anything, perhaps the error message which PHP displays on a stack overflow could be improved. --- Zend/tests/bug48770.phpt | 41 ++++++++++---------------------------- Zend/tests/bug48770_2.phpt | 10 ++++------ Zend/tests/bug48770_3.phpt | 7 +------ 3 files changed, 16 insertions(+), 42 deletions(-) diff --git a/Zend/tests/bug48770.phpt b/Zend/tests/bug48770.phpt index e96047c79be33..13ff963d0677e 100644 --- a/Zend/tests/bug48770.phpt +++ b/Zend/tests/bug48770.phpt @@ -1,53 +1,34 @@ --TEST-- Bug #48770 (call_user_func_array() fails to call parent from inheriting class) ---XFAIL-- -See Bug #48770 --FILE-- func('This should work!'); +$c->callFuncInParent('Which function will be called??'); ?> --EXPECT-- -string(26) "A::func: This should work!" +B::func called diff --git a/Zend/tests/bug48770_2.phpt b/Zend/tests/bug48770_2.phpt index b8f88445f8189..f3bfffcba6e8a 100644 --- a/Zend/tests/bug48770_2.phpt +++ b/Zend/tests/bug48770_2.phpt @@ -1,7 +1,5 @@ --TEST-- Bug #48770 (call_user_func_array() fails to call parent from inheriting class) ---XFAIL-- -See Bug #48770 --FILE-- func('This should work!'); ?> --EXPECT-- -string(27) "A::func2: This should work!" -string(27) "A::func3: This should work!" -call_user_func_array(): Argument #1 ($function) must be a valid callback, cannot access private method A::func22() -call_user_func_array(): Argument #1 ($function) must be a valid callback, class 'A' does not have a method 'inexistent' +string(27) "B::func2: This should work!" +string(27) "B::func3: This should work!" +call_user_func_array(): Argument #1 ($function) must be a valid callback, cannot access private method B::func22() +call_user_func_array(): Argument #1 ($function) must be a valid callback, class 'B' does not have a method 'inexistent' diff --git a/Zend/tests/bug48770_3.phpt b/Zend/tests/bug48770_3.phpt index 0ce0d6911987a..f2b537363b560 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-- func('This should work!'); --EXPECT-- string(27) "B::func2: This should work!" string(27) "B::func3: This should work!" -call_user_func_array(): Argument #1 ($function) must be a valid callback, class 'B' does not have a method 'inexistent' +call_user_func_array(): Argument #1 ($function) must be a valid callback, class 'C' does not have a method 'inexistent'