PHP Namesapces and call_user_func

I was doing a little experimental meta-programming in OroCRM and stumbled across another unknown-to-me quirk w/r/t PHP namespaces and the call_user_func function. It turns out PHP's callback pseudo-types don't inherit the namespace they're called from.

That is, consider something like this

namespace Pulsestorm\Example;
class Main
{
    static public function test()
    {

    }

    static public function main()
    {
        call_user_func(array('Main',test));    
    }
}

My previous assumptions here were that call_user_func would look for a Main class in the currently defined namespace. However, that's not the case. Instead, it looks for a Main class in the global namespace.

In order to do what I wanted, I needed the full namespace path in the call_user_func function

call_user_func(array('Pulsestorm\Example\Main',test));    

You can also use the PHP magic constant __NAMESPACE__ if you like

call_user_func(array(__NAMESPACE__.'\Main',test));    

I'm sure there's good reasons for this tradeoff on the implementation level, but it's another of example of PHP's attempt to solve one problem (global everything) creating more mental work for full-stack, multi-framework developers.