Issues

ZF-6602: Using Loader_Autoloader is not working on application with modules with similar names.

Description

Hi,

I'm not sure if the problem is with Zend_Loader or Zend_Application (maybe other compoment), the problem is:

I use a modular application layout like this:

application/ config/ data/ ../ modules/ admin/ controllers/ models/ views/ ../ adminservices/ controllers/ models/ views/ ../ admintest/ adminxxx/ somename/ somenameetc/ module1/ module2/ module3/

As you can see I use modules with similar names, all modules use their Bootstrap so autoload works fine.. I can use models from any module BUT if found a problem for example:

If I try to load a model of module named "admin" from module "module1" or any other module it work OK. if I try to load a model of module named "adminservices" from any module it do not works, autoloader it not loading the class so I get a:

Fatal error: Class 'Adminservices_Model_XXXX' not found

I try with other modules and I can see that any modules that start with similar names autoloader only register the first one, so I can only call clases from admin, somename, etc, any other clases that start with this name it not working with autoloader..

Anyone can confirm this??? or I'm doing something wrong??

Thanks

Lyle

Comments

This is a test project with the problem, from the quickstart zend project.

I created a testcase in the zip you provided:


class AutoloaderTest extends PHPUnit_Framework_TestCase
{
    public function setUp()
    {   
        $this->application = new Zend_Application(
            APPLICATION_ENV,
            APPLICATION_PATH . '/configs/application.ini'
        );
        $this->application->bootstrap();
    }

    public function testModelAutoloading()
    {   
        $model1 = new Admin_Model_TestAdmin();
        $model2 = new Adminservices_Model_TestAdminservices();
    }
}

This passes. (If the autoloader had been unable to load either class, PHPUnit would have reported the error.)

So, basically, I'm unable to reproduce the error using the code you provided, and running off of current trunk.

Please give a try on this: after install the test application check the url:

public/default/index/index

It will execute this code:

echo 'TEST START HERE: ' . '


';

    echo 'Call model from default module:'. '<br />';
    $modelo = new Default_Model_TestDefault();
    echo $modelo->printName() . '<br /><br />';

    echo 'Call model from admin module:'. '<br />';
    $modelo = new Admin_Model_TestAdmin();
    echo $modelo->printName() . '<br /><br />';

<<<< This will fail to load <<<

    echo 'Call model from adminservices module:'. '<br />';
    $modelo = new Adminservices_Model_TestAdminservices();
    echo $modelo->printName() . '<br /><br />';

Anyone else can reproduce the problem???