File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug48770.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:52 2012 UTC (13 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>