Catch empty deprecation.log silently (fixes #31050)

This commit is contained in:
Matthias Althaus 2019-04-11 13:28:50 +02:00 committed by Nicolas Grekas
parent 5f4c27f0de
commit 291c73a290
1 changed files with 5 additions and 1 deletions

View File

@ -126,9 +126,13 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
return [];
}
if ('' === $logContent = trim(file_get_contents($file))) {
return [];
}
$bootTime = filemtime($file);
$logs = [];
foreach (unserialize(file_get_contents($file)) as $log) {
foreach (unserialize($logContent) as $log) {
$log['context'] = ['exception' => new SilencedErrorContext($log['type'], $log['file'], $log['line'], $log['trace'], $log['count'])];
$log['timestamp'] = $bootTime;
$log['priority'] = 100;