In a ZF3 custom module, I need to intercept some events.
In the module.config.php, the function init() is :
public function init(ModuleManager $manager)
{
$eventManager = $manager->getEventManager();
$sharedEventManager = $eventManager->getSharedManager();
$sharedEventManager->attach(__NAMESPACE__, MvcEvent::EVENT_DISPATCH, [$this, 'onDispatch'], 100);
$sharedEventManager->attach(__NAMESPACE__, MvcEvent::EVENT_DISPATCH_ERROR, [$this, 'onDispatchError'], 110);
}
In the same class, there are the two functions :
public function onDispatch(MvcEvent $event)
{
echo 'testOnDispatch';
die;
}
public function onDispatchError(MvcEvent $event)
{
echo 'testOnDispatchError';
die;
}
The EVENT_DISPATCH event is triggered without any problem but the EVENT_DISPATCH_ERROR is not. After some tests, I saw that only the EVENT_DISPATCH event is triggered.
In the view manager configuration, both display_not_found_reason and display_exceptions are both set to TRUE. If I replace EVENT_DISPATCH_ERROR with EVENT_DISPATCH (twice EVENT_DISPATCH) all is working fine regarding the priority.
What did I miss?