Skip to content

Commit 9fded1f

Browse files
committed
Catch empty deprecation.log silently (fixes #31050)
1 parent 9dfd8f1 commit 9fded1f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,13 @@ private function getContainerDeprecationLogs()
127127
return [];
128128
}
129129

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

0 commit comments

Comments
 (0)