ZF-11870: Some inconsistencies between finding the controller and finding the view script in Zend_Controller_Action_Helper_ViewRenderer

Issue Type: Bug Created: 2011-11-04T15:34:30.000+0000 Last Updated: 2012-05-29T17:46:25.000+0000 Status: Closed Fix version(s): Reporter: Adam Kosecki (adamkosecki) Assignee: Adam Lundrigan (adamlundrigan) Tags: - Zend_Controller

Related issues: - ZF-11204



Using no user defined routes, the logic used to find a the controller and view are inconsistent and may find the controller without finding the script.

The following url:


Will hit NewsController, CaseStudiesAction, but barf when it tries to find 'news/case-studies-.phtml'.

Inspecting the Zend_Controller_Action_Helper_ViewRenderer::getInflector(), we see why:

':module' => array('Word_CamelCaseToDash', 'StringToLower'), ':controller' => array('Word_CamelCaseToDash', new Zend_Filter_Word_UnderscoreToSeparator('/'), 'StringToLower', new Zend_Filter_PregReplace('/./', '-')), ':action' => array('Word_CamelCaseToDash', new Zend_Filter_PregReplace('#[^a-z0-9' . preg_quote('/', '#') . ']+#i', '-'), 'StringToLower'),

The controller regex will remove periods, while the action regex does not.

If it finds the controller, it should find the associated view script, per your documentation. Or, at the very least, a better exception than EXCEPTION_OTHER should be thrown, as it's currently not possible to reliably trigger a 404 condition, which it should. (it's logical to return a 500 for EXCEPTION_OTHER, while throwing a 404 for EXCEPTION_NO_CONTROLLER and EXCEPTION_NO_ACTION). Maybe an EXCEPTION_NO_SCRIPT? Or, better yet, have it find the viewscript if it finds the controller.


Posted by Adam Lundrigan (adamlundrigan) on 2012-05-29T17:46:21.000+0000

Duplicate of ZF-11204

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.