PHP  
 PHP_5_5
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.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:         static 
$avoid_crash 0;
21:         
22:         if (
$avoid_crash++ == 1) {
23:             print 
"This method shouldn't be called when using parent::func!\n";
24:             return;
25:         }
26:                 
27:         
call_user_func_array(array($this'parent::func'), array($str));
28:     }
29:     private function 
func2($str) {
30:         
var_dump(__METHOD__ .': '$str);
31:     }
32:     protected function 
func3($str) {
33:         
var_dump(__METHOD__ .': '$str);
34:     }
35: }
36:
37: class 
extends {
38:     public function 
func($str) {
39:         
parent::func($str);
40:     }
41: }
42:
43:
$c = new C;
44:
$c->func('This should work!');
45:
46:
?>
47:

Expected

%unicode|string%(26) "A::func: This should work!"

Output

This method shouldn't be called when using parent::func!

Diff

001+ This method shouldn't be called when using parent::func!
001- %unicode|string%(26) "A::func: This should work!"

 

Generated at Sun, 26 Oct 2014 06:24:57 +0000 (4 days ago)

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