Issues

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

Issue Type: Bug Created: 2008-01-17T07:55:38.000+0000 Last Updated: 2008-03-21T16:25:29.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Luiz Damim (luizvd) Assignee: Ralph Schindler (ralph) Tags: - Zend_Controller

  • Zend_Filter

Related issues: Attachments:

Description

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.

Code:

<pre class="literal">
$vr = $this->_helper->viewRenderer;
$vr->setView($this->view)
     ->setViewBasePathSpec(':moduleDir/:module')
     ->initView();

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/mvc.vilagenet.com.br/application/modules/:module' in /data/W/mvc.vilagenet.com.br/library/Zend/Filter/Inflector.php:454 Stack trace:

0 /data/W/mvc.vilagenet.com.br/library/Zend/Controller/Action/Helper/ViewRenderer.php(363): Zend_Filter_Inflector->filter(Array)

1 /data/W/mvc.vilagenet.com.br/library/Zend/Controller/Action/Helper/ViewRenderer.php(438): Zend_Controller_Action_Helper_ViewRenderer->_getBasePath()

2 /data/W/mvc.vilagenet.com.br/library/Vilage/Controller/Action.php(30): Zend_Controller_Action_Helper_ViewRenderer->initView()

3 /data/W/mvc.vilagenet.com.br/library/Zend/Controller/Action.php(129): Vilage_Controller_Action->init()

4 /data/W/mvc.vilagenet.com.br/library/Zend/Controller/Dispatcher/Standard.php(218): Zend_Controller_Action->__construct(Object(Zend_Controller_Request_Http in /data/W/mvc.vilagenet.com.br/library/Zend/Filter/Inflector.php on line 454

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

Comments

Posted by Carlton Gibson (carlton) on 2008-01-19T07:44:10.000+0000

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...

Posted by Matthew Weier O'Phinney (matthew) on 2008-02-04T15:31:00.000+0000

Assigning to Ralph

Posted by Matthew Weier O'Phinney (matthew) on 2008-02-14T11:22:34.000+0000

Upgrading status to must have for 1.5

Posted by Ralph Schindler (ralph) on 2008-02-19T15:20:34.000+0000

Please check revision 8177 for a fix.

-ralph

Posted by Ralph Schindler (ralph) on 2008-02-20T08:56:25.000+0000

If there are any issues here, please reopen.

-ralph

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