Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.9.6
-
Fix Version/s: None
-
Component/s: Zend_Controller
-
Labels:None
Description
This bug shows when you have 2+ actions in stack and first runs ok and any subsequent produces error:
class IndexController extends Zend_Controller_Action { public function indexAction() { $this->view->message = 'run ok'; $this->_helper->actionStack('nonExistentAction', 'nonExistentController'); } }
As far as I debugged this - layout plugin's postDispatch() wraps content twice with layout script, didn't look deeper to find why.
Of cause adding non-existent actions into stack is just for example. Actually I move user request to second action and my first action does some stuff that must precede any processing. And if request goes to non-existent controller - user sees such a 'beautiful' thing.
As workaround:
class ErrorController extends Zend_Controller_Action { public function errorAction() { $this->getResponse()->clearBody(); ..... } }
P.S. Bug is trivial - by default Zend_Layout_Controller_Plugin_Layout is registered at index 99, Zend_Controller_Plugin_ErrorHandler at index 100. In postDispatch() layout plugin finds that request is dispatched and runs its actions, then error handler's postDispatch() adds another request and layout plugin finds another dispathed request and runs again. Changing register order solves the problem.
Assigning to Ralph