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

Add INF/NaN normalization, fixes #523

This commit is contained in:
Jordi Boggiano
2015-03-05 00:57:49 +00:00
parent 4a794ed5f8
commit d434bb4794
2 changed files with 15 additions and 0 deletions

View File

@@ -58,6 +58,15 @@ class NormalizerFormatter implements FormatterInterface
protected function normalize($data)
{
if (null === $data || is_scalar($data)) {
if (is_float($data)) {
if (is_infinite($data)) {
return ($data > 0 ? '' : '-') . 'INF';
}
if (is_nan($data)) {
return 'NaN';
}
}
return $data;
}