protected function restoreErrorHandler($handler) { if ($handler) { set_error_handler($handler); } else { // unfortunately, we can't pass null until PHP 5.5 set_error_handler(function () { return false; }); } }