I use the Zend_Loader_Autoloader to load classes. My namespace is "Foo".

According to the docs (http://is.gd/v5zW) I should provide an
underscore after the namespace:

require_once 'Zend/Loader/Autoloader.php';

$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('Foo_');

When I try to access a class constant (echo Foo::CONST), however, I
get the following error:

Fatal error: Class 'Foo' not found in /var/www/[..]/www/index.php on line 38

Changing autoloader's registerNamespace to "Foo" (without the
underscore) rectifies the problem:

$autoloader->registerNamespace('Foo');

Similarly, using $autoloader->setFallbackAutoloader(true) works as expected.

Is this intended behavior, a bug (in code and/or documentation) or am
I missing something?

Thank you in advance.

Jonathan Maron

Reply via email to