Skip to content

Commit e817587

Browse files
Merge branch '5.4' into 6.0
* 5.4: Fix merge [HttpKernel] Guard against bad profile data Fix deprecations on PHP 8.2
2 parents 948ff45 + 64d15cd commit e817587

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Profiler/FileProfilerStorage.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ public function read(string $token): ?Profile
121121
$file = 'compress.zlib://'.$file;
122122
}
123123

124-
return $this->createProfileFromData($token, unserialize(file_get_contents($file)));
124+
if (!$data = unserialize(file_get_contents($file))) {
125+
return null;
126+
}
127+
128+
return $this->createProfileFromData($token, $data);
125129
}
126130

127131
/**
@@ -287,7 +291,11 @@ protected function createProfileFromData(string $token, array $data, Profile $pa
287291
$file = 'compress.zlib://'.$file;
288292
}
289293

290-
$profile->addChild($this->createProfileFromData($token, unserialize(file_get_contents($file)), $profile));
294+
if (!$childData = unserialize(file_get_contents($file))) {
295+
continue;
296+
}
297+
298+
$profile->addChild($this->createProfileFromData($token, $childData, $profile));
291299
}
292300

293301
return $profile;

0 commit comments

Comments
 (0)