From b4e942d8537ed977dd970943dca091731ffdf744 Mon Sep 17 00:00:00 2001 From: radar3301 Date: Tue, 11 Jul 2023 17:42:43 -0600 Subject: [PATCH] Update FileProfilerStorage.php fix "Undefined array key" by skipping invalid/corrupted lines --- .../HttpKernel/Profiler/FileProfilerStorage.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php index 3a0309b6d4acd..33a3f4242df37 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php +++ b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php @@ -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;