Zend\Log\Logger::registerErrorHandler() should accept a parameter to set the return value of the error_handler callback #3366

Closed
rgrellmann opened this Issue Jan 7, 2013 · 1 comment

Comments

Projects
None yet
2 participants

In Zend\Log\Logger::registerErrorHandler() the PHP function set_error_handler() is used. The callback is defined as an anonymous function. This function does not return anything, so it is not possible to use the native PHP error handling together with custom error handling.

According to the PHP manual the callback function can return FALSE, in that case the native PHP error handling is triggered after the custom error handler has been executed.

  1. I propose an additional parameter to registerErrorHandler():
    public static function registerErrorHandler(Logger $logger, $nativeErrorHandling = false) { ... }

  2. the definition of the anonymous callback function should be changed to use the new parameter:
    function($errno, $errstr, $errfile, $errline, $errcontext) use ($errorHandlerMap, $logger, $nativeErrorHandling) {

  3. Near the end of the anonymous callback function (currently line 396 in ZF 2.0.6) something like this should be added:
    if ($nativeErrorHandling) {
    return false;
    }

Owner

weierophinney commented Jan 21, 2013

Closed with merge of #3493

@gianarb gianarb pushed a commit to zendframework/zend-log that referenced this issue May 15, 2015

@marc-mabe marc-mabe [Log] fixes zendframework/zendframework#3366: Now Logger::registerErr…
…orHandler() accepts an argument to continue native error handler + The error <-> priority map is a public static array
581e6ac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment