New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix warnings in case of incorrect data #482
Fix warnings in case of incorrect data #482
Conversation
I think either the code needs to handle missing keys like the LogstashFormatter does or you just should not call it with invalid records, but rejecting messages silently is not good. |
In our code we perform checks that value returned from formatter is instance of Message. |
I don't see where the normalizer ignores data. Anyway I would be ok to throwing an exception if some essential keys are needed (or if they are not essential, then do a isset check and go through with a default value or null when they're missing), but the current PR is not ok for me. |
@@ -98,4 +102,21 @@ public function format(array $record) | |||
|
|||
return $message; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a DocBlock here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
Updated, please review. |
@Seldaek, what do you think about this pr? |
I fixed it in another way so it mostly works except if essential data is missing then you get an exception. |
If somebody pass incorrect input array to
format
, php will raise several notices, because no any checks performed before access to array indexes.Please review.