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


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.


Duplicate of ZF-11204