Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9483779

Browse filesBrowse files
bug #31076 [HttpKernel] Fixed LoggerDataCollector crashing on empty file (althaus)
This PR was submitted for the 4.2 branch but it was merged into the 3.4 branch instead (closes #31076). Discussion ---------- [HttpKernel] Fixed LoggerDataCollector crashing on empty file | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #31050 | License | MIT This PR adds a check to the LoggerDataCollector if there's acutal some content in the log file. Commits ------- 291c73a Catch empty deprecation.log silently (fixes #31050)
2 parents 5f4c27f + 291c73a commit 9483779
Copy full SHA for 9483779

File tree

1 file changed

+5
-1
lines changed
Filter options

1 file changed

+5
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php
+5-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.