Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.0.0, 1.0.1, 1.0.2
-
Fix Version/s: 1.0.3
-
Component/s: Zend_Controller
-
Labels:None
Description
If you have previously used setNoController function (of ViewRenderer Helper), to disable looking for the view in a sub-directory with the controller's name, in your actions controller, it will be over-written later due to a flaw.
public function init() { $this->_helper->viewRenderer->setRender('test'); $this->_helper->viewRenderer->setNoController(true); }
This won't work, nor will it work using preDispatch(). The problem is on Zend/Controller/Action.php in this piece of code:
public function getViewScript($action = null, $noController = null) { if (!$this->getInvokeArg('noViewRenderer') && $this->_helper->hasHelper('viewRenderer')) { $viewRenderer = $this->_helper->getHelper('viewRenderer'); $viewRenderer->setNoController($noController); return $viewRenderer->getViewScript($action); }
$noController, a null value, is passed through setNoController function and the setNoController function assumes if the value isn't true, it's false. So null is considered false, and a value is set also it isn't supposed to.
I think either a test needs to be made in Actions.php or inside the setNoController function, for the null value.
Example in ViewRender helper:
if ($flag === null) { return; }
Or in Actions.php:
if ($noController !== null) { $viewRenderer->setNoController($noController); }
This caused me a major headache when I was trying to implement the code (which is pasted at beginning of the issue), and I had to use setNeverController() instead.
Assigned to Matthew