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

Handle depth to avoid cases where an exception has many too many previous exceptions, fixes #1726

This commit is contained in:
Jordi Boggiano
2022-07-22 14:18:01 +02:00
parent ffc2bc2e23
commit 83db4b3f81
2 changed files with 10 additions and 0 deletions

View File

@@ -198,6 +198,10 @@ class NormalizerFormatter implements FormatterInterface
*/
protected function normalizeException(Throwable $e, int $depth = 0)
{
if ($depth > $this->maxNormalizeDepth) {
return ['Over ' . $this->maxNormalizeDepth . ' levels deep, aborting normalization'];
}
if ($e instanceof \JsonSerializable) {
return (array) $e->jsonSerialize();
}