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

Appearance settings

Commit 6ef994c

Browse filesBrowse files
bug #45610 [HttpKernel] Guard against bad profile data (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [HttpKernel] Guard against bad profile data | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #45606 | License | MIT | Doc PR | - Commits ------- f4a2089 [HttpKernel] Guard against bad profile data
2 parents d4150be + f4a2089 commit 6ef994c
Copy full SHA for 6ef994c

File tree

1 file changed

+10
-2
lines changed
Filter options

1 file changed

+10
-2
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ public function read($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
/**
@@ -297,7 +301,11 @@ protected function createProfileFromData($token, $data, $parent = null)
297301
$file = 'compress.zlib://'.$file;
298302
}
299303

300-
$profile->addChild($this->createProfileFromData($token, unserialize(file_get_contents($file)), $profile));
304+
if (!$childData = unserialize(file_get_contents($file))) {
305+
continue;
306+
}
307+
308+
$profile->addChild($this->createProfileFromData($token, $childData, $profile));
301309
}
302310

303311
return $profile;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.