Skip to content

Commit 64d15cd

Browse files
Merge branch '4.4' into 5.4
* 4.4: [HttpKernel] Guard against bad profile data Fix deprecations on PHP 8.2
2 parents e40dcf8 + c265924 commit 64d15cd

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
@@ -123,7 +123,11 @@ public function read(string $token): ?Profile
123123
$file = 'compress.zlib://'.$file;
124124
}
125125

126-
return $this->createProfileFromData($token, unserialize(file_get_contents($file)));
126+
if (!$data = unserialize(file_get_contents($file))) {
127+
return null;
128+
}
129+
130+
return $this->createProfileFromData($token, $data);
127131
}
128132

129133
/**
@@ -295,7 +299,11 @@ protected function createProfileFromData(string $token, array $data, Profile $pa
295299
$file = 'compress.zlib://'.$file;
296300
}
297301

298-
$profile->addChild($this->createProfileFromData($token, unserialize(file_get_contents($file)), $profile));
302+
if (!$childData = unserialize(file_get_contents($file))) {
303+
continue;
304+
}
305+
306+
$profile->addChild($this->createProfileFromData($token, $childData, $profile));
299307
}
300308

301309
return $profile;

0 commit comments

Comments
 (0)