summaryrefslogtreecommitdiff
path: root/Zend/tests/call_user_func_001.phpt
blob: b4b29c850a69bde7767841b1ddd60d3d8918b245 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--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(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