ZF-6273: Zend_Controller_Plugin_ErrorHandler record 2 times in Zend_Controller_Plugin_Broker

Description

1. The plugin Zend_Controller_Plugin_ErrorHandler record 2 times

index.php ... $frontController = Zend_Controller_Front::getInstance(); $frontController->registerPlugin(new Initialisation() ); $frontController->dispatch();

Initialisation.php ... $plugin = new Zend_Controller_Plugin_ErrorHandler(); $plugin->setErrorHandlerModule('commun') ->setErrorHandlerController('error') ->setErrorHandlerAction('error'); $this->_front->registerPlugin($plugin); ...

The method registerPlugin of Zend_Controller_Plugin_Broker is called 4 times. 1 - registerPlugin(Initialization, null) 2 - registerPlugin(Zend_Controller_Plugin_ErrorHandler, 100) 3 - registerPlugin(Zend_Layout_Controller_Plugin_Layout, 99) 4 - registerPlugin(Zend_Controller_Plugin_ErrorHandler, null)

In the Zend_Controller_Plugin_Broker array_search (line 54) return false if want to register the second time Zend_Controller_Plugin_ErrorHandler.

When there is a problem (Example: no controller), my controller error (common module) is not known but rather uses ZF module by default.

Dump after the fourth call (Zend_Debug:: dump ($ this-> getPlugins ())):

array(4) { [0] => object(Initialisation)#4 (13) { ["_config:private"] => object(Zend_Config_Ini)#5 (9) { ["_nestSeparator:protected"] => string(1) "." ["_skipExtends:protected"] => bool(false) ["_allowModifications:protected"] => bool(false) ["_index:protected"] => int(0) ["_count:protected"] => int(7) ..... [99] => object(Zend_Layout_Controller_Plugin_Layout)#27 (4) { ["_layoutActionHelper:protected"] => object(Zend_Layout_Controller_Action_Helper_Layout)#28 (4) { ["_frontController:protected"] => object(Zend_Controller_Front)#1 (11) { ["_baseUrl:protected"] => NULL ["_controllerDir:protected"] => NULL ["_dispatcher:protected"] => object(Zend_Controller_Dispatcher_Standard)#16 (11) { ..... [100] => object(Zend_Controller_Plugin_ErrorHandler)#10 (7) { ["_errorModule:protected"] => NULL ["_errorController:protected"] => string(5) "error" ["_errorAction:protected"] => string(5) "error" ["_isInsideErrorHandlerLoop:protected"] => bool(false) ["_exceptionCountAtFirstEncounter:protected"] => int(0) ["_request:protected"] => object(Zend_Controller_Request_Http)#13 (14) { ["_paramSources:protected"] => array(2) { [0] => string(4) "_GET" [1] => string(5) "_POST" } ["_requestUri:protected"] => string(56) "...." ["_baseUrl:protected"] => NULL ["_basePath:protected"] => NULL ["_pathInfo:protected"] => string(0) "" ["_params:protected"] => array(0) { } ["_aliases:protected"] => array(0) { } ["_dispatched:protected"] => bool(false) ["_module:protected"] => NULL ["_moduleKey:protected"] => string(6) "module" ["_controller:protected"] => NULL ["_controllerKey:protected"] => string(10) "controller" ["_action:protected"] => NULL ["_actionKey:protected"] => string(6) "action" } ["_response:protected"] => object(Zend_Controller_Response_Http)#14 (8) { ["_body:protected"] => array(0) { } ["_exceptions:protected"] => array(0) { } ["_headers:protected"] => array(0) { } ["_headersRaw:protected"] => array(0) { } ["_httpResponseCode:protected"] => int(200) ["_isRedirect:protected"] => bool(false) ["_renderExceptions:protected"] => bool(false) ["headersSentThrowsException"] => bool(true) } } [3] => object(Zend_Controller_Plugin_ErrorHandler)#32 (7) { ["_errorModule:protected"] => string(6) "commun" ["_errorController:protected"] => string(5) "error" ["_errorAction:protected"] => string(5) "error" ["_isInsideErrorHandlerLoop:protected"] => bool(false) ["_exceptionCountAtFirstEncounter:protected"] => int(0) ["_request:protected"] => NULL ["_response:protected"] => NULL } }


2. It works when I put the plugin Zend_Controller_Plugin_ErrorHandler in my index.php and that I removed in initialisation.php

The method registerPlugin of Zend_Controller_Plugin_Broker is called 3 times. 1 - registerPlugin (Zend_Controller_Plugin_ErrorHandler, null) 2 - registerPlugin (Initialization, null) 3 - registerPlugin (Zend_Layout_Controller_Plugin_Layout, 99)

index.php ... $frontController = Zend_Controller_Front::getInstance();

$plugin = new Zend_Controller_Plugin_ErrorHandler(); $plugin->setErrorHandlerModule('commun') ->setErrorHandlerController('error') ->setErrorHandlerAction('error'); $frontController->registerPlugin($plugin);

$frontController->registerPlugin(new Initialisation() ); $frontController->dispatch();

I want to be able to register the plugin Zend_Controller_Plugin_ErrorHandler in my plugin initialization and not be forced to put it in index.php

Comments

My French is rusty; would it be possible to get an English translation so I can be sure I understand the issue report correctly?

My English is not very good. I tried to translate into English this issue.

this should be possible with application.ini and all features available in 1.11