diff --git a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php index 9a90c0d45ef6..86fc2c68d10e 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php +++ b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php @@ -129,7 +129,6 @@ public function read($token) public function write(Profile $profile) { $file = $this->getFilename($profile->getToken()); - $exists = file_exists($file); // Create directory $dir = dirname($file); @@ -150,7 +149,10 @@ public function write(Profile $profile) file_put_contents($file, serialize($data)); // Add to index - $file = fopen($this->getIndexFilename(), 'a'); + if (false === $file = fopen($this->getIndexFilename(), 'w')) { + return false; + } + fputcsv($file, array( $profile->getToken(), $profile->getIp(), @@ -160,7 +162,7 @@ public function write(Profile $profile) )); fclose($file); - return !$exists; + return true; } /**