{"action":"opened","issue":{"url":"https://api.github.com/repos/zendframework/zf2/issues/7497","labels_url":"https://api.github.com/repos/zendframework/zf2/issues/7497/labels{/name}","comments_url":"https://api.github.com/repos/zendframework/zf2/issues/7497/comments","events_url":"https://api.github.com/repos/zendframework/zf2/issues/7497/events","html_url":"https://github.com/zendframework/zf2/issues/7497","id":73925476,"number":7497,"title":"Zend\\Stdlib\\ErrorHandler breaks custom error handlers","user":{"login":"lukasclausen","id":12088944,"avatar_url":"https://avatars.githubusercontent.com/u/12088944?v=3","gravatar_id":"","url":"https://api.github.com/users/lukasclausen","html_url":"https://github.com/lukasclausen","followers_url":"https://api.github.com/users/lukasclausen/followers","following_url":"https://api.github.com/users/lukasclausen/following{/other_user}","gists_url":"https://api.github.com/users/lukasclausen/gists{/gist_id}","starred_url":"https://api.github.com/users/lukasclausen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukasclausen/subscriptions","organizations_url":"https://api.github.com/users/lukasclausen/orgs","repos_url":"https://api.github.com/users/lukasclausen/repos","events_url":"https://api.github.com/users/lukasclausen/events{/privacy}","received_events_url":"https://api.github.com/users/lukasclausen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-07T10:01:34Z","updated_at":"2015-05-07T10:01:34Z","closed_at":null,"body":"I know this issue has already been discussed, but it still exists. The Logger error handler only works for the first triggered error:\r\n```php\r\n$logger = new Zend\\Log\\Logger();\r\n$streamOrUrl = array('stream' => 'php://stdout');\r\n$writer = new Zend\\Log\\Writer\\Stream($streamOrUrl);\r\n$logger->addWriter($writer);\r\nZend\\Log\\Logger::registerErrorHandler($logger);\r\n\r\ntrigger_error('Some notice');\r\ntrigger_error('Some other notice');\r\n```\r\nThe second notice will not be logged. That's because of the `Zend\\Stdlib\\ErroHandler::start/stop()` call in the log writers. I know this error handler calls are there for good reason, but they break the main custom error handler. In more detail the nested set_error_handler calls inside Zend\\Stdlib\\ErroHandler breaks it. I found out that the second parameter of set_error_handler causes the error when used inside of an error_handler. I suppose that's a php bug. The following won't work for the second error:\r\n\r\n```php\r\n$eh = function($level,$message) {\r\n    $error_handler2 = function ($level,$message) {\r\n        echo \"Handle Error inside: $message \\n\";\r\n    };\r\n    set_error_handler($error_handler2,E_WARNING);\r\n    echo \"Handle Error: $message \\n\";\r\n    strpos();\r\n    restore_error_handler();\r\n    return true;\r\n};\r\n\r\n set_error_handler($eh);\r\n \r\n trigger_error('Some message',E_USER_NOTICE);\r\n trigger_error('Some other message',E_USER_NOTICE);\r\n```\r\nWhen changing `set_error_handler($error_handler2,E_WARNING);` to `set_error_handler($error_handler2);` the code works as expected. So removing the second argument of `set_error_handler` inside   Zend\\Stdlib\\ErroHandler start for me also fixes my logger error handler problems. Is there a reason why  `Zend\\Stdlib\\ErroHandler::start` is limited to E_WARNINGS by default?"}}