From cc76da1144bbeb57db6faafcfd2242e055276275 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 15 Oct 2011 01:48:44 +0200 Subject: [PATCH] [HttpKernel] fixed file profile storage when trying to read an empty token --- .../HttpKernel/Profiler/FileProfilerStorage.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php index 3c97e6e837a0..422d430c6960 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php +++ b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php @@ -81,7 +81,7 @@ public function find($ip, $url, $limit) 'ip' => $csvIp, 'url' => $csvUrl, 'time' => $csvTime, - 'parent' => $csvParent + 'parent' => $csvParent, ); $result[] = $row; @@ -116,9 +116,7 @@ public function purge() */ public function read($token) { - $file = $this->getFilename($token); - - if (!file_exists($file)) { + if (!$token || !file_exists($file = $this->getFilename($token))) { return null; } @@ -159,7 +157,7 @@ public function write(Profile $profile) $profile->getIp(), $profile->getUrl(), $profile->getTime(), - $profile->getParent() ? $profile->getParent()->getToken() : null + $profile->getParent() ? $profile->getParent()->getToken() : null, )); fclose($file); @@ -171,7 +169,7 @@ public function write(Profile $profile) fclose($fp); } - return ! $exists; + return !$exists; } /** @@ -205,7 +203,7 @@ protected function getChildrenFilename($token) */ protected function getIndexFilename() { - return $this->folder.'/'.'index.csv'; + return $this->folder.'/index.csv'; } /** @@ -246,6 +244,6 @@ protected function readLineFromFile($file) fseek($file, -2, SEEK_CUR); } - return $str === "" ? $this->readLineFromFile($file) : $str; + return $str === '' ? $this->readLineFromFile($file) : $str; } }