Skip to content

Commit d9df6c0

Browse files
committed
[HttpKernel][LoggerDataCollector] Prevent keys collisions in the sanitized logs processing
1 parent 855cb1e commit d9df6c0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

DataCollector/LoggerDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ private function sanitizeLogs($logs)
172172
continue;
173173
}
174174

175-
$message = $log['message'];
175+
$message = '_'.$log['message'];
176176
$exception = $log['context']['exception'];
177177

178178
if ($exception instanceof SilencedErrorContext) {

Tests/DataCollector/LoggerDataCollectorTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,15 @@ public function getCollectTestData()
132132
[
133133
['message' => 'foo3', 'context' => ['exception' => new \ErrorException('warning', 0, E_USER_WARNING)], 'priority' => 100, 'priorityName' => 'DEBUG'],
134134
['message' => 'foo3', 'context' => ['exception' => new SilencedErrorContext(E_USER_WARNING, __FILE__, __LINE__)], 'priority' => 100, 'priorityName' => 'DEBUG'],
135+
['message' => '0', 'context' => ['exception' => new SilencedErrorContext(E_USER_WARNING, __FILE__, __LINE__)], 'priority' => 100, 'priorityName' => 'DEBUG'],
135136
],
136137
[
137138
['message' => 'foo3', 'context' => ['exception' => ['warning', E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG'],
138139
['message' => 'foo3', 'context' => ['exception' => [E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => true],
140+
['message' => '0', 'context' => ['exception' => [E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => true],
139141
],
140142
0,
141-
1,
143+
2,
142144
];
143145
}
144146
}

0 commit comments

Comments
 (0)