Skip to content

Commit 7005d86

Browse files
authored
Fix Trying to access array offset on false on LogsCollector.php (#1763)
1 parent 376ebb1 commit 7005d86

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/DataCollector/LogsCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ public function getLogs($file)
106106

107107
// There has GOT to be a better way of doing this...
108108
preg_match_all($pattern, $file, $headings);
109-
$log_data = preg_split($pattern, $file);
109+
$log_data = preg_split($pattern, $file) ?: [];
110110

111111
$log = [];
112112
foreach ($headings as $h) {
113113
for ($i = 0, $j = count($h); $i < $j; $i++) {
114114
foreach ($log_levels as $ll) {
115115
if (strpos(strtolower($h[$i]), strtolower('.' . $ll))) {
116-
$log[] = ['level' => $ll, 'header' => $h[$i], 'stack' => $log_data[$i]];
116+
$log[] = ['level' => $ll, 'header' => $h[$i], 'stack' => $log_data[$i] ?? ''];
117117
}
118118
}
119119
}

0 commit comments

Comments
 (0)