You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The NormalizerFormatter::setJsonPrettyPrint() function takes a boolean that should either enable or disable the "pretty print" formatting. I'm assuming that is the intention, though it is not explicly documented.
However, the parameter provided has this effect instead:
true - set JSON "pretty print" on.
false - toggle JSON "pretty print" on or off.
I believe the fix should be:
$this->jsonEncodeOptions &= ~JSON_PRETTY_PRINT;
I need to test that that further, in case the number of bits set for the inverse of JSON_PRETTY_PRINT is not enough for the datatype of $this->jsonEncodeOptions, requiring perhaps some longint casting (just a hunch, but I really haven't dug into it that deeply yet), but it works for me as a quick test.
Happy to provide a PR if you aggree with this, including some documentation clarifications. I guess it is not urgent, having been around for a long time, and there is a workaround (which I am using here) that will also be forward-compatible with this fix.
The text was updated successfully, but these errors were encountered:
Monolog version 2.1.0 (used by Laravel 7.0)
https://github.com/Seldaek/monolog/blob/master/src/Monolog/Formatter/NormalizerFormatter.php#L102
The
NormalizerFormatter::setJsonPrettyPrint()
function takes a boolean that should either enable or disable the "pretty print" formatting. I'm assuming that is the intention, though it is not explicly documented.However, the parameter provided has this effect instead:
true
- set JSON "pretty print" on.false
- toggle JSON "pretty print" on or off.I believe the fix should be:
I need to test that that further, in case the number of bits set for the inverse of
JSON_PRETTY_PRINT
is not enough for the datatype of$this->jsonEncodeOptions
, requiring perhaps some longint casting (just a hunch, but I really haven't dug into it that deeply yet), but it works for me as a quick test.There is a workaround at present:-
To enable JSON pretty print:
To disable JSON pretty print:
i.e. toggle from a known state.
Happy to provide a PR if you aggree with this, including some documentation clarifications. I guess it is not urgent, having been around for a long time, and there is a workaround (which I am using here) that will also be forward-compatible with this fix.
The text was updated successfully, but these errors were encountered: