File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug46246.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 #46246 (difference between call_user_func(array($this, $method)) and $this->$method())
    3: --FILE--
    4: <?php
    5: class A
    6: {
    7: 	private function Test()
    8: 	{
    9: 		echo 'Hello from '.get_class($this)."\n";
   10: 	}
   11: 	
   12: 	public function call($method, $args = array())
   13: 	{
   14: 		$this->Test();
   15: 		$this->$method();
   16: 		call_user_func(array($this, $method));
   17: 	}
   18: }
   19: 
   20: class B extends A
   21: {
   22: 	protected function Test()
   23: 	{
   24: 		echo 'Overridden hello from '.get_class($this)."\n";
   25: 	}
   26: }
   27: 
   28: $a = new A;
   29: $b = new B;
   30: 
   31: $a->call('Test');
   32: $b->call('Test');
   33: ?>
   34: --EXPECT--
   35: Hello from A
   36: Hello from A
   37: Hello from A
   38: Hello from B
   39: Hello from B
   40: Hello from B

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