File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / call_user_func_001.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, 2 months 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

--TEST--
Testing call_user_func inside namespace
--FILE--
<?php

namespace testing {
	function foobar($str) {
		var_dump($str);
	}
	
	abstract class bar {
		protected function prot($str) {
			print "Shouldn't be called!\n";
		}
	}
	class foo extends bar {
		private function priv($str) {
			print "Shouldn't be called!\n";
		}
	}
	
	call_user_func(__NAMESPACE__ .'\foobar', 'foobar');
	
	$class =  __NAMESPACE__ .'\foo';
	call_user_func(array(new $class, 'priv'), 'foobar');
	call_user_func(array(new $class, 'prot'), 'foobar');
}

?>
--EXPECTF--
%string|unicode%(6) "foobar"

Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access private method testing\foo::priv() in %s on line %d

Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access protected method testing\foo::prot() in %s on line %d

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