mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 08:05:53 +03:00
[GH-ISSUE #110] IntrospectionProcessor and LineFormatter invalid JSON #38
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#38
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jrjohnson on GitHub (Sep 5, 2012).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/110
The introspection processor adds the class name to the extra paramters - if this name is namespaced (has a ) then the json that results from LineFormatter is invalid and cannot be re-assembled using json_decode.
eg:
Its possible this is addressed in PHP 5.4 using the JSON_UNESCAPED_SLASHES - but it should be backwards compatible as well. I assume this would be an issue for any unescape slashes added by any of the processors.
@stof commented on GitHub (Sep 5, 2012):
Please fix your markdown to use code-blocks when necessary, to avoid the escaping of the content. The link to the markdown help is available both in the footer of the github website and near the comment form
@stof commented on GitHub (Sep 5, 2012):
and btw, in which place does it create invalid json ? LineFormatter is not meant to produce json (there is a JsonFormatter for that)
@jrjohnson commented on GitHub (Sep 5, 2012):
LineFormater produces JSON in convertToString which gets called in format for every value in extras. It looks to me like the written output of extras is intended to be JSON.
@stof commented on GitHub (Sep 5, 2012):
@jrjohnson it uses json_encode in some cases (note that it is not all cases), because it is a readable way to write arrays on 1 line. But it was never intended to write json. If you want to log as JSON, use the dedicated formatter
@jrjohnson commented on GitHub (Sep 5, 2012):
OK so the extras string is just a comma separated list of values inclosed in {} that is very nearly correct JSON?
{"line":432,"function":"handleException","ip":"206.211.148.90","http_method":"GET","referrer":"NULL"}@Seldaek commented on GitHub (Sep 5, 2012):
Indeed in 5.4 it will return proper json, but in 5.3 it didn't because of the slightly too greedy stripslashes. Fixed now.