Return to bug48770_2.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests |
1.1 ! misho 1: --TEST-- ! 2: Bug #48770 (call_user_func_array() fails to call parent from inheriting class) ! 3: --XFAIL-- ! 4: See Bug #48770 ! 5: --FILE-- ! 6: <?php ! 7: ! 8: class 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: ! 23: class B extends A { ! 24: public function func($str) { ! 25: call_user_func_array(array($this, 'parent::func2'), array($str)); ! 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)); ! 29: } ! 30: private function func2($str) { ! 31: var_dump(__METHOD__ .': '. $str); ! 32: } ! 33: protected function func3($str) { ! 34: var_dump(__METHOD__ .': '. $str); ! 35: } ! 36: } ! 37: ! 38: class C extends B { ! 39: public function func($str) { ! 40: parent::func($str); ! 41: } ! 42: } ! 43: ! 44: $c = new C; ! 45: $c->func('This should work!'); ! 46: ! 47: ?> ! 48: --EXPECTF-- ! 49: %unicode|string%(27) "A::func2: This should work!" ! 50: %unicode|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