PHP  
 PHP_5_4
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Expected Test Failure Report for Zend/tests/bug48770_2.phpt ('Bug #48770 (call_user_func_array() fails to call parent from inheriting class)')

Script

1: <?php
2:  
3:
class {
4:     public function 
func($str) {
5:         
var_dump(__METHOD__ .': '$str);
6:     }
7:     private function 
func2($str) {
8:         
var_dump(__METHOD__ .': '$str);
9:     }
10:     protected function 
func3($str) {
11:         
var_dump(__METHOD__ .': '$str);        
12:     }
13:     private function 
func22($str) {
14:         
var_dump(__METHOD__ .': '$str);        
15:     }
16: }
17:
18: class 
extends {
19:     public function 
func($str) {
20:           
call_user_func_array(array($this'parent::func2'), array($str));
21:           
call_user_func_array(array($this'parent::func3'), array($str));
22:           
call_user_func_array(array($this'parent::func22'), array($str));
23:           
call_user_func_array(array($this'parent::inexistent'), array($str));
24:     }
25:     private function 
func2($str) {
26:         
var_dump(__METHOD__ .': '$str);
27:     }
28:     protected function 
func3($str) {
29:         
var_dump(__METHOD__ .': '$str);
30:     }
31: }
32:
33: class 
extends {
34:     public function 
func($str) {
35:         
parent::func($str);
36:     }
37: }
38:
39:
$c = new C;
40:
$c->func('This should work!');
41:
42:
?>
43:

Expected

%unicode|string%(27) "A::func2: This should work!"
%unicode|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

Output

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, cannot access private method B::func22() in /var/php_gcov/PHP_5_4/Zend/tests/bug48770_2.php on line 22

Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'B' does not have a method 'inexistent' in /var/php_gcov/PHP_5_4/Zend/tests/bug48770_2.php on line 23

Diff

001+ string(27) "B::func2: This should work!"
002+ string(27) "B::func3: This should work!"
003+ 
004+ Warning: call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method B::func22() in /var/php_gcov/PHP_5_4/Zend/tests/bug48770_2.php on line 22
001- %unicode|string%(27) "A::func2: This should work!"
002- %unicode|string%(27) "A::func3: This should work!"
004- Warning: call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method A::func22() in %s on line %d
006+ Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'B' does not have a method 'inexistent' in /var/php_gcov/PHP_5_4/Zend/tests/bug48770_2.php on line 23
005- 
006- 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

 

Generated at Thu, 16 Oct 2014 05:27:17 +0000 (5 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.