diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php index fa0d4a86712b6..d20bfaa1b0c4c 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php @@ -387,16 +387,22 @@ private function save($key, $data) $tmpFile = tempnam(dirname($path), basename($path)); if (false === $fp = @fopen($tmpFile, 'wb')) { + @unlink($tmpFile); + return false; } @fwrite($fp, $data); @fclose($fp); if ($data != file_get_contents($tmpFile)) { + @unlink($tmpFile); + return false; } if (false === @rename($tmpFile, $path)) { + @unlink($tmpFile); + return false; } }