Further to my last post, in order for my suggested Front Controller change to work, a change needs to also be made to Zend_Controller_Plugin_ErrorHandler to add a preDispatch() method.
Here's my suggested change (tested against ZF 1.7.3)
Zend_Controller_Plugin_ErrorHandler (begins line 189)
/*** preDispatch() plugin hook -- check for exceptions during routing and* dispatches the error handler if necessary** @see {@link Zend_Controller_Plugin_ErrorHandler::_handleException}* @param Zend_Controller_Request_Abstract $request* @return void*/public function preDispatch(Zend_Controller_Request_Abstract $request){$this->_handleException($request);}/*** postDispatch() plugin hook -- check for exceptions during the dispatch* loop and dispatches the error handler if necessary** @see {@link Zend_Controller_Plugin_ErrorHandler::_handleException}* @param Zend_Controller_Request_Abstract $request* @return void*/public function postDispatch(Zend_Controller_Request_Abstract $request){$this->_handleException($request);}/*** Check for exceptions and dispatch error handler if necessary** If the 'noErrorHandler' front controller flag has been set,* returns early.** @param Zend_Controller_Request_Abstract $request* @return void*/private function _handleException(Zend_Controller_Request_Abstract $request){// ... code that used to be in postDispatch() goes in here}
And for completeness, I'll repeat my change to Zend_Controller_Front (begins line 893):
try {/*** Notify plugins of router startup*/$this->_plugins->routeStartup($this->_request);$router->route($this->_request);/*** Notify plugins of router completion*/$this->_plugins->routeShutdown($this->_request);/*** Notify plugins of dispatch loop startup*/$this->_plugins->dispatchLoopStartup($this->_request);} catch (Exception $e) {if ($this->throwExceptions()) {throw $e;}$this->_response->setException($e);}
Cheers, Scott