diff --git a/Profiler/FileProfilerStorage.php b/Profiler/FileProfilerStorage.php index 1ef58dc74c..d729994c1f 100644 --- a/Profiler/FileProfilerStorage.php +++ b/Profiler/FileProfilerStorage.php @@ -123,7 +123,11 @@ public function read($token): ?Profile $file = 'compress.zlib://'.$file; } - return $this->createProfileFromData($token, unserialize(file_get_contents($file))); + if (!$data = unserialize(file_get_contents($file))) { + return null; + } + + return $this->createProfileFromData($token, $data); } /** @@ -297,7 +301,11 @@ protected function createProfileFromData($token, $data, $parent = null) $file = 'compress.zlib://'.$file; } - $profile->addChild($this->createProfileFromData($token, unserialize(file_get_contents($file)), $profile)); + if (!$childData = unserialize(file_get_contents($file))) { + continue; + } + + $profile->addChild($this->createProfileFromData($token, $childData, $profile)); } return $profile;