[HttpKernel][LoggerDataCollector] Prevent keys collisions in the sanitized logs processing

This commit is contained in:
Thomas Calvet 2020-03-27 17:16:43 +01:00
parent a29ee7c220
commit 79fe888072
2 changed files with 4 additions and 2 deletions

View File

@ -172,7 +172,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
continue;
}
$message = $log['message'];
$message = '_'.$log['message'];
$exception = $log['context']['exception'];
if ($exception instanceof SilencedErrorContext) {

View File

@ -132,13 +132,15 @@ class LoggerDataCollectorTest extends TestCase
[
['message' => 'foo3', 'context' => ['exception' => new \ErrorException('warning', 0, E_USER_WARNING)], 'priority' => 100, 'priorityName' => 'DEBUG'],
['message' => 'foo3', 'context' => ['exception' => new SilencedErrorContext(E_USER_WARNING, __FILE__, __LINE__)], 'priority' => 100, 'priorityName' => 'DEBUG'],
['message' => '0', 'context' => ['exception' => new SilencedErrorContext(E_USER_WARNING, __FILE__, __LINE__)], 'priority' => 100, 'priorityName' => 'DEBUG'],
],
[
['message' => 'foo3', 'context' => ['exception' => ['warning', E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG'],
['message' => 'foo3', 'context' => ['exception' => [E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => true],
['message' => '0', 'context' => ['exception' => [E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => true],
],
0,
1,
2,
];
}
}