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

Issue Type: Bug Created: 2009-05-11T03:49:27.000+0000 Last Updated: 2009-05-11T08:41:54.000+0000 Status: Resolved Fix version(s): Reporter: Lyle Arnot (larnot) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Loader

Related issues: Attachments: -



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??




Posted by Lyle Arnot (larnot) on 2009-05-11T07:14:13.000+0000

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

Posted by Matthew Weier O'Phinney (matthew) on 2009-05-11T08:35:09.000+0000

I created a testcase in the zip you provided:

<pre class="highlight">
class AutoloaderTest extends PHPUnit_Framework_TestCase
    public function setUp()
        $this->application = new Zend_Application(
            APPLICATION_PATH . '/configs/application.ini'

    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.

Posted by Lyle Arnot (larnot) on 2009-05-11T08:41:52.000+0000

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


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???

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.