Issues

ZF-7063: Zend_Loader_Autoloader::getClassAutoloaders() incorrectly detects module namespaces...

Issue Type: Bug Created: 2009-06-21T05:26:34.000+0000 Last Updated: 2009-08-21T04:30:21.000+0000 Status: Resolved Fix version(s): Reporter: Tim Lockwood (stinkyweezl) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Loader

Related issues: Attachments:

Description

My application is structured as follows...

application modules admin sales sales-admin

In Zend_Loader_Autoloader (line 308), it detects the namespace incorrectly and returns the wrong autoloader for all classes in sales-admin (instead bringing back those from Sales.

Proposed fix is to replace line 308 if (0 === strpos($class, $ns)) {

with the following if (0 === strpos($class, $ns.'_')) {

This seems to fix things, but I'm not entirely sure if that's going to cover it... maybe a little regex would be more helpful...

Comments

Posted by Ben Fox (wildfoxmedia) on 2009-07-14T01:18:37.000+0000

I would just like to add that I am having the same issue with 2 modules/namespaces of my own.

news & news-aggregator

Posted by Hinikato Dubrai (hinikato) on 2009-08-20T16:45:33.000+0000

Yes, I have the same problem too. If two modules begin with the same prefix, then Zend_Loader_Autoloader will return invalid result.

For example, if we have "foo" module and "foo-bar" module, Zend_Loader_Autoloader will return autoloaders for the first module ("foo").

Posted by Hinikato Dubrai (hinikato) on 2009-08-20T17:12:40.000+0000

This is bug example:

<pre class="highlight">
new Zend_Application_Module_Autoloader(array('namespace' => 'Foo', 'basePath' => dirname(__FILE__)));
new Zend_Application_Module_Autoloader(array('namespace' => 'FooBar', 'basePath' => dirname(__FILE__)));
$autoloaders = Zend_Loader_Autoloader::getInstance()->getClassAutoloaders('FooBar_Model');
Zend_Debug::dump($autoloaders[0]->getNamespace());
// Will output: string(3) "Foo"

Posted by Matthew Weier O'Phinney (matthew) on 2009-08-21T04:30:19.000+0000

This was fixed for 1.9.1 (see ZF-7473)

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts