Hi Fredrik,

On Fri, 2008-02-29 at 16:02 +0100,
"=?ISO-8859-1?Q?Fredrik_Holmstr=F6m?=" wrote:
> Basicly, the call is this: Demo::Functions::test(); where both Demo
> and Functions are namespaces, and test() is a function inside the
> Demo::Functions namespace. If you have an autoload handler here and
> the file containing the Demo::Function::test()-decleration isn't
> loaded, autoload will be called.
> 
> Now everything seems fine, but the problem is that when the autoload
> hooks have all fired php looks for the class Demo::Function, because
> autoload seems to be interpreting the Demo::Function::test(); call as:
> <Namespace>::<Class>::<Function>, when it should be
> <Namespace>::<Namespace>::<Function>, and since the Function class
> doesn't exist it will trigger a fatal error.

autoload was designed for loading classes not functions. Wen resolving
Demo::Function::test() and no function having that name is being found
it's assumed that Demo is the namespace, function a class name in there
and test a static method call. There's no way for the engine to see what
else might be meant. So the result is expected and changing it woud mean
to do major changes wich just creates new problems.

johannes


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to