My beforeException function looks like this (simplified):
public function beforeException(Event $event, Dispatcher $dispatcher, \Exception $exception) {
...
$this -> _logger -> log(get_class($exception) . '===========================================' .
PHP_EOL . $exception -> getMessage() . PHP_EOL, Logger::ERROR);
if (!$isXdebugEnabled){
$this -> flashSession->error('Unexpected error occured. Please contact the administrator.');
$this -> response -> redirect($moduleName . '/index/route500');
return false;
}
}
and intended to supress error messages on production by logging them and redirect client to page 500. Most of the time it works but it fails when encontering errors like this:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes)
Is it possible to catch this type of error in principle?