Skip to content

Commit

Permalink
Update FileProfilerStorage.php
Browse files Browse the repository at this point in the history
fix "Undefined array key" by skipping invalid/corrupted lines
  • Loading branch information
radar3301 authored and nicolas-grekas committed Jul 13, 2023
1 parent 09f5778 commit b4e942d
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -315,7 +315,15 @@ private function removeExpiredProfiles(): void
}

while ($line = fgets($handle)) {
[$csvToken, , , , $csvTime] = str_getcsv($line);
$values = str_getcsv($line);

if (7 !== \count($values)) {
// skip invalid lines
$offset += \strlen($line);
continue;
}

[$csvToken, , , , $csvTime] = $values;

if ($csvTime >= $minimalProfileTimestamp) {
break;
Expand Down

0 comments on commit b4e942d

Please sign in to comment.