mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-04 12:17:35 +02:00
Suppress errors when json_encode has ignoreErrors set
This commit is contained in:
@@ -38,13 +38,17 @@ class Utils
|
|||||||
$encodeFlags = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
|
$encodeFlags = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$json = json_encode($data, $encodeFlags);
|
if ($ignoreErrors) {
|
||||||
|
$json = @json_encode($data, $encodeFlags);
|
||||||
if (false === $json) {
|
if (false === $json) {
|
||||||
if ($ignoreErrors) {
|
|
||||||
return 'null';
|
return 'null';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $json;
|
||||||
|
}
|
||||||
|
|
||||||
|
$json = json_encode($data, $encodeFlags);
|
||||||
|
if (false === $json) {
|
||||||
$json = self::handleJsonError(json_last_error(), $data);
|
$json = self::handleJsonError(json_last_error(), $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user