Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
rgrellmann opened this Issue · 1 comment

2 participants

@rgrellmann

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;
}

@marc-mabe marc-mabe referenced this issue from a commit in marc-mabe/zf2
@marc-mabe marc-mabe [Log] fixes #3366: Now Logger::registerErrorHandler() accepts an argu…
…ment to continue native error handler + The error <-> priority map is a public static array
a7920c0
@weierophinney

Closed with merge of #3493

@katalonec katalonec referenced this issue from a commit in katalonec/zf2
@weierophinney weierophinney Merge branch 'feature/3493' into develop
Close #3493
Fixes #3366
6b6d5ea
@ghost Unknown referenced this issue from a commit
@marc-mabe marc-mabe [Log] fixes #3366: Now Logger::registerErrorHandler() accepts an argu…
…ment to continue native error handler + The error <-> priority map is a public static array
7f60d68
@ghost Unknown referenced this issue from a commit
@weierophinney weierophinney Merge branch 'feature/3493' into develop
Close #3493
Fixes #3366
459e0bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.