ZF-2443: ViewRenderer's setViewBasePathSpec() does not recognize the placeholders :module, :controller or :action


When changing the default script path using Zend_Controller_Action_Helper_ViewRenderer::setViewBasePathSpec(), the placeholders :module, :controller and :action are not recognized by the inflector.


$vr = $this->_helper->viewRenderer;

Exception thrown: Fatal error: Uncaught exception 'Zend_Filter_Exception' with message 'A replacement identifier : was found inside the inflected target, perhaps a rule was not satisfied with a target source? Unsatisfied inflected target: /data/W/' in /data/W/ Stack trace:

0 /data/W/ Zend_Filter_Inflector->filter(Array)

1 /data/W/ Zend_Controller_Action_Helper_ViewRenderer->_getBasePath()

2 /data/W/ Zend_Controller_Action_Helper_ViewRenderer->initView()

3 /data/W/ Vilage_Controller_Action->init()

4 /data/W/ Zend_Controller_Action->__construct(Object(Zend_Controller_Request_Http in /data/W/ on line 454

I´m using the snapshot ZendFramework-20080117-7469.


I looked into this briefly. This is not a solution but a possible line of enquiry:

From r7089, in ViewRenderer::_getBasePath() an empty array is passed to the inflector's filter method:

[Lines 360 -363 : ViewRenderer::_getBasePath()] $inflector = $this->getInflector(); $this->_setInflectorTarget($this->getViewBasePathSpec()); $path = $inflector->filter(array()); return $path;

Should it not pass $this->_inflectorTarget instead?

From Zend/Filter/Inflector.php:

Inflector::filter() begins with a foreach on the passed array, which isn't going to get very far if that is empty...

Assigning to Ralph

Upgrading status to must have for 1.5

Please check revision 8177 for a fix.


If there are any issues here, please reopen.