ZF2-566: Undefined indexes and huge args-data in Zend\Log\Formatter\ExceptionHandler::format

Description

In Zend\Log\Formatter\ExceptionHandler::format the assumtion is made that the indexes file, line, class and type always exist:


foreach ($event'extra']['trace'] as $trace) {
    $outputTrace .= "File  : {$trace['file']}\n"
                  . "Line  : {$trace['line']}\n"
                  . "Func  : {$trace['function']}\n"
                  . "Class : {$trace['class']}\n"
                  . "Type  : " . $this->getType($trace['type']) . "\n"
                  . "Args  : " . print_r($trace['args'], true) . "\n";
}

But:

The first trace does not contain the file and line indexes

When the trace refers to a function (like call_user_func()), the indexes class and type do not exist

print_r($trace['args'], true) creates a huge, huge string of data because all classes and their descendants are completely added as a string

I honestly think the logging (of exceptions) needs a serious rewrite, because there are just so many errors in it that it is unusable in this stage (also see [ZF2-562 and ZF2-563).

Comments

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf2/issues/2592