ZF-9435: Zend_Application_Bootstrap_Boostrap::getResourceLoader() calculates extra, invalid paths for Autoloader

Description

If an application is using an empty appnamespace, the Zend_Application_Bootstrap_Boostrap::getResourceLoader() incorrectly adds the path to Zend/Application/Bootstrap to the autoloader, causing the application to have to scan extra directories when looking to map plugins, models, etc. Attached is a patch that changes the identical comparison to an equality comparison when testing the appnamespace to avoid the extra erroneous paths.

Comments

Downgrading to minor performance improvement

Fixed in trunk(25072) and release-1.2(25073)

So now if I have application/plugins Plugin_Example the autoloader will not find it, unless I'll add a resource loader to the loader's stack ? All my applications stopped working after this path.

@Jacek Register your plugin. Look at the docs. (Example #5)

Hello Frank, thanks for your response. That's not a problem with plugin registration as it is already registered. It just doesnt know that Plugin_ resides in /plugins.

I'm using default directory structure and all resources fail to load as Zend_Application_Module_Autoloader pointing to my APPLICATION_PATH is not initialized anymore. application/services Service_ application/models Model_ application/plugins Plugin_ application/forms Form_

Those are "application-wide" resources used in all modules. My default module resides in /modules/default and that is probably the problem here.

So if anyone out there is using such structure, and APPLICATION_PATH/{model|form|etc...} to store their base classes or reusable components for other modules, after update to 1.12.1 it will stop working.

{


public function _initResourceLoader()
    {
        if($this->getResourceLoader() === null){
            $this->setResourceLoader(new Zend_Application_Module_Autoloader(array(
                'namespace' => $this->getAppNamespace(),
                'basePath'  => dirname(__FILE__),
            )));
        }
    }
{

I use this too, simply to load "Form_Foo" from "/application/forms/Foo.php". Now it breaks :(


production]
appNamespace = ;Zend_Application_Module_Autoloader

If i delete that entry, everything works as intended, no resource loader is built. Haven't tested for modules tough.

I suspect the source code change was not need, maybe it's possible to reach the desired performance improvement with a more precise/explicit configuration and still have the [#AbuseCase to work with.

I like to reopen and revert this. To my understanding the feature worked as intended.