Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit201ad71

Browse files
minor#50947 [HttpKernel] Skip corrupted CSV data in FileProfilerStorage (radar3301)
This PR was merged into the 6.3 branch.Discussion----------[HttpKernel] Skip corrupted CSV data in FileProfilerStorage| Q | A| ------------- | ---| Branch? | 6.3| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets | Partiallyfixes#50942, improves/fixes on PR#50913, partially fixes#50816| License | MITTechnically, part of this fix could go all the way back to 2.1, but since we're not sure why/how exactly the index.csv file is being corrupted in the first place, this PR should just serve as a stop-gap measure until the root cause can be identified.A corrupted index.csv file is especially noticeable since 6.3, when the "Remove Expired Profiles" feature was added by#47352 .RE: improves/fixes on PR#50913:Warnings are (usually?) only escalated to errors in debug mode, so having a try/catch is a bit more overhead than I think is actually needed, and I believe just checking that the line read from the csv is not corrupted is the better/faster option. Granted, the profiler should really only be active in debug/non-production modes anyway, but "should" and reality usually don't align...`@alamirault` `@MatTheCat` `@benjaminfunk` `@Pelagoss` `@derrabus`Commits-------b4e942d Update FileProfilerStorage.php
2 parents09f5778 +b4e942d commit201ad71

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,15 @@ private function removeExpiredProfiles(): void
315315
}
316316

317317
while ($line =fgets($handle)) {
318-
[$csvToken, , , ,$csvTime] =str_getcsv($line);
318+
$values =str_getcsv($line);
319+
320+
if (7 !==\count($values)) {
321+
// skip invalid lines
322+
$offset +=\strlen($line);
323+
continue;
324+
}
325+
326+
[$csvToken, , , ,$csvTime] =$values;
319327

320328
if ($csvTime >=$minimalProfileTimestamp) {
321329
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp