I have set the autoloader to use the Fallback Autoloader like this:
$autoloader=Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);
If I look at php errors, a notice is generated for every call to a Zend_View_Helper with it trying to read the helper at for example: /var/www/arc/views/helpers/. Here is a sample notice:
fopen(/var/www/arc/views/helpers/Layout.php) [<a href='function.fopen'>function.fopen</a>]:
failed to open stream: No such file or directory in file /private/var/www/arc/ZendFramework-
1.9.5/library/Zend/Loader.php at line: 165
It seems like the issue is here:
["_prefixToPaths:protected"] => array(1) {
["Zend_View_Helper_"] => array(2) {
[0] => string(17) "Zend/View/Helper/"
[1] => string(34) "/var/www/arc/views/helpers/"
}
Does using the FallbackAutoloader cause this to happen? It would seem to be a potential performance issue. Also, it should resolve the namespace Zend_View_Helper_ correctly? What am I missing here?
Update: no, Zend/View/Helper/Layout.php is there.
Maybe, I'm missing the point of what the Zend_Loader_Autoloader is supposed to be doing (I think the docs are somewhat weak in this case).
For example, if I adjust my application.ini file to the following: [production] phpSettings.display_startup_errors = 0 phpSettings.display_errors = 0 includePaths.library = APPLICATION_PATH "/../library" includePaths.models= APPLICATION_PATH "/models" includePaths.helper= APPLICATION_PATH "/controllers/helpers" bootstrap.path = APPLICATION_PATH "/Bootstrap.php" bootstrap.class = "Bootstrap" resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
and output the include_path, the models, directory is clearly in the include path but not loading the class.
If I then add the following in a Bootstrap _init function
$autoloader=Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);
It loads fine. For the former situation, do I need to set a Namespace?
to first comment: here are current values with output:
Zend_Debug::dump($loader->isFallbackAutoloader(),'is fallback autoloader');
is fallback autoloader bool(false)
Zend_Debug::dump($loader->getDefaultAutoloader(),'default autoloader');
default autoloader array(2) {
[0] => &string(11) "Zend_Loader"
[1] => string(9) "loadClass"
}
Zend_Debug::dump($loader->getAutoloaders(),'autoloaders');
autoloaders array(0) {
}
thanks