-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Handle fatal error on exception in __toString methods #673
Labels
Comments
antonsergeyev
pushed a commit
to antonsergeyev/monolog
that referenced
this issue
Oct 25, 2015
…which may throw an exception
Seldaek
added a commit
that referenced
this issue
Oct 29, 2015
#673 Fix fatal error while normalizing with __toString method
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When a NormalizerFormatter tries to normalize an object that implements '__toString' method, and this method throws an exception (which is exceptionally bad, but still), it results in a messy fatal error, which is hard to debug. This is especially painful if happens in the process of logging another error or exception, so we end up not knowing what the original error was.
The solution, i think, is to simply call '$data->__toString()' instead of '(string) $data', which will correctly throw an exception instead of triggering fatal error.
The text was updated successfully, but these errors were encountered: