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

View File

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