ZF-6502: Zend_Application_Resource_Modules does not correctly compute Bootstrap classname

Issue Type: Bug Created: 2009-05-03T02:09:09.000+0000 Last Updated: 2009-05-11T07:08:38.000+0000 Status: Resolved Fix version(s): - 1.8.1 (12/May/09)

Reporter: thing2b (thing2b) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Application

Related issues: Attachments:


When Zend_Application_Resource_Modules works to use a module with a dash in it, it does not work correctly. When it comes across a module name (and directory name) of item-type, it tries to look for a class called "item-type_Bootstrap".

This does not agree with how things are done in Zend_Controller_Dispatcher_Abstract->_formatName();

A simple fix would be to replace the line:

$bootstrapClass = ucfirst($module) . '_Bootstrap';

in Zend_Application_Resource_Modules with:

$segment = str_replace(array('-', '.'), ' ', strtolower($module)); $segment = preg_replace('/[^a-z0-9 ]/', '', $segment); $module = str_replace(' ', '', ucwords($segment)); $bootstrapClass = ucfirst($module) . '_Bootstrap';


Posted by Matthew Weier O'Phinney (matthew) on 2009-05-11T03:43:15.000+0000

Fixed in trunk and 1.8 release branch.

Posted by -.- (campasau) on 2009-05-11T03:58:21.000+0000

Line 111 in this fix is unnessesary.

<pre class="literal">
$name = ucwords($name);

Posted by Matthew Weier O'Phinney (matthew) on 2009-05-11T05:57:34.000+0000

Um, yes, that line is necessary -- that's precisely the functionality implemented in the dispatcher's getModuleName() method (via _formatName()). It allows the ability to translate foo-bar to FooBar -- without ucwords(), it would be simply Foobar -- which is incorrect.

Posted by Jorge Padron (jpadron) on 2009-05-11T06:27:19.000+0000

Yes, the function ucwords() is necessary, but it's used twice: lines 111-112

Posted by Matthew Weier O'Phinney (matthew) on 2009-05-11T07:08:37.000+0000

OOps! Thanks -- I've updated the code now to remove the extraneous call.

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.