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    try {
26        call_user_func(array(new $class, 'priv'), 'foobar');
27    } catch (\TypeError $e) {
28        echo $e->getMessage(), "\n";
29    }
30    try {
31        call_user_func(array(new $class, 'prot'), 'foobar');
32    } catch (\TypeError $e) {
33        echo $e->getMessage(), "\n";
34    }
35}
36
37?>
38--EXPECT--
39string(6) "foobar"
40call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access private method testing\foo::priv()
41call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access protected method testing\foo::prot()
42