Skip to content

Commit 291c73a

Browse files
althausnicolas-grekas
authored andcommitted
Catch empty deprecation.log silently (fixes #31050)
1 parent 5f4c27f commit 291c73a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,13 @@ private function getContainerDeprecationLogs()
126126
return [];
127127
}
128128

129+
if ('' === $logContent = trim(file_get_contents($file))) {
130+
return [];
131+
}
132+
129133
$bootTime = filemtime($file);
130134
$logs = [];
131-
foreach (unserialize(file_get_contents($file)) as $log) {
135+
foreach (unserialize($logContent) as $log) {
132136
$log['context'] = ['exception' => new SilencedErrorContext($log['type'], $log['file'], $log['line'], $log['trace'], $log['count'])];
133137
$log['timestamp'] = $bootTime;
134138
$log['priority'] = 100;

0 commit comments

Comments
 (0)