Skip to content

Commit d30f689

Browse files
authored
Update FileProfilerStorage.php
fix "Undefined array key" by skipping invalid/corrupted lines
1 parent e0b8655 commit d30f689

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ public function find(?string $ip, ?string $url, ?int $limit, ?string $method, in
5656
$result = [];
5757
while (\count($result) < $limit && $line = $this->readLineFromFile($file)) {
5858
$values = str_getcsv($line);
59+
60+
if (count($values) < 7) {
61+
// skip invalid lines
62+
continue;
63+
}
64+
5965
[$csvToken, $csvIp, $csvMethod, $csvUrl, $csvTime, $csvParent, $csvStatusCode] = $values;
6066
$csvTime = (int) $csvTime;
6167

@@ -309,7 +315,14 @@ private function removeExpiredProfiles(): void
309315
}
310316

311317
while ($line = fgets($handle)) {
312-
[$csvToken, , , , $csvTime] = str_getcsv($line);
318+
$values = str_getcsv($line);
319+
320+
if (count($values) < 4) {
321+
// skip invalid lines
322+
continue;
323+
}
324+
325+
[$csvToken, , , , $csvTime] = $values;
313326

314327
if ($csvTime >= $minimalProfileTimestamp) {
315328
break;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy