1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-22 09:06:10 +02:00

Resolve json encoding errors issue globally, refs #137

This commit is contained in:
Jordi Boggiano
2013-01-06 20:14:14 +01:00
parent 271c396964
commit 63e3bfdf7e
5 changed files with 71 additions and 52 deletions

View File

@@ -81,10 +81,11 @@ class LineFormatter extends NormalizerFormatter
return (string) $data;
}
$data = $this->normalize($data);
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
return json_encode($this->normalize($data), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
return $this->toJson($data);
}
return str_replace('\\/', '/', json_encode($this->normalize($data)));
return str_replace('\\/', '/', json_encode($data));
}
}