So I've been messing around with the latest 5.3-dev builds on my
localhost, after testing out the Namespace-feature in 5.3-dev by
porting parts of my own framework to it I ran into some buggy (or
atleast wierd) behaviour concerning autoload and functions inside
namespaces.

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.

I have included an example in the __autoload.zip
(http://arenagrande.tv/__autoload.zip), containing 3 files, check the
comment in demo.php for a better explenation.

However, I can see why php would behave this way, since autoload was
intended for classes and not functions, but imho. autoload should be
made to work perfectly with namespaces aswell as classes.

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

Reply via email to