diff --git a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php index 5797bdc41587a..c6c23289ab020 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php +++ b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php @@ -119,6 +119,10 @@ public function read($token): ?Profile return null; } + if (\function_exists('gzcompress')) { + $file = 'compress.zlib://'.$file; + } + return $this->createProfileFromData($token, unserialize(file_get_contents($file))); } @@ -161,7 +165,14 @@ public function write(Profile $profile): bool 'status_code' => $profile->getStatusCode(), ]; - if (false === file_put_contents($file, serialize($data))) { + $context = stream_context_create(); + + if (\function_exists('gzcompress')) { + $file = 'compress.zlib://'.$file; + stream_context_set_option($context, 'zlib', 'level', 3); + } + + if (false === file_put_contents($file, serialize($data), 0, $context)) { return false; } @@ -282,6 +293,10 @@ protected function createProfileFromData($token, $data, $parent = null) continue; } + if (\function_exists('gzcompress')) { + $file = 'compress.zlib://'.$file; + } + $profile->addChild($this->createProfileFromData($token, unserialize(file_get_contents($file)), $profile)); }
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: