1--TEST-- 2Testing call_user_func inside namespace 3--FILE-- 4<?php 5 6namespace testing { 7 function foobar($str) { 8 var_dump($str); 9 } 10 11 abstract class bar { 12 protected function prot($str) { 13 print "Shouldn't be called!\n"; 14 } 15 } 16 class foo extends bar { 17 private function priv($str) { 18 print "Shouldn't be called!\n"; 19 } 20 } 21 22 call_user_func(__NAMESPACE__ .'\foobar', 'foobar'); 23 24 $class = __NAMESPACE__ .'\foo'; 25 call_user_func(array(new $class, 'priv'), 'foobar'); 26 call_user_func(array(new $class, 'prot'), 'foobar'); 27} 28 29?> 30--EXPECTF-- 31%string|unicode%(6) "foobar" 32 33Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access private method testing\foo::priv() in %s on line %d 34 35Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access protected method testing\foo::prot() in %s on line %d 36