mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-22 00:56:08 +02:00
Merge branch '1.x'
This commit is contained in:
@@ -187,9 +187,20 @@ class NormalizerFormatter implements FormatterInterface
|
||||
if (isset($frame['file'])) {
|
||||
$data['trace'][] = $frame['file'].':'.$frame['line'];
|
||||
} elseif (isset($frame['function']) && $frame['function'] === '{closure}') {
|
||||
// We should again normalize the frames, because it might contain invalid items
|
||||
// Simplify closures handling
|
||||
$data['trace'][] = $frame['function'];
|
||||
} else {
|
||||
if (isset($frame['args'])) {
|
||||
// Make sure that objects present as arguments are not serialized nicely but rather only
|
||||
// as a class name to avoid any unexpected leak of sensitive information
|
||||
$frame['args'] = array_map(function ($arg) {
|
||||
if (is_object($arg) && !$arg instanceof \DateTimeInterface) {
|
||||
return sprintf("[object] (%s)", get_class($arg));
|
||||
}
|
||||
|
||||
return $arg;
|
||||
}, $frame['args']);
|
||||
}
|
||||
// We should again normalize the frames, because it might contain invalid items
|
||||
$data['trace'][] = $this->toJson($this->normalize($frame, $depth + 1), true);
|
||||
}
|
||||
|
Reference in New Issue
Block a user