From 4dfbc16a5b920c4ee84e84f75cd49372c2926128 Mon Sep 17 00:00:00 2001 From: Gilles Maurer Date: Wed, 9 Nov 2016 02:11:22 +0100 Subject: [PATCH] Fix Cache write verification PHP operator '===' is the only strict way to mix up the value '0' and the value 'FALSE'. The function saveData of the FileCache tests if the write of the cache files was done with success and raise an Exception if not. The test was done without the '===' operator, and if the data is 0 bytes long the error message says there is a permission error, which is false. A data 0 bytes long is another issue, either in the json_encode function either in the Bridge, but not a permission issue. --- caches/FileCache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/caches/FileCache.php b/caches/FileCache.php index 79ed6d04..0e010678 100644 --- a/caches/FileCache.php +++ b/caches/FileCache.php @@ -14,7 +14,7 @@ class FileCache implements CacheInterface { public function saveData($datas){ $writeStream = file_put_contents($this->getCacheFile(), json_encode($datas, JSON_PRETTY_PRINT)); - if(!$writeStream) { + if($writeStream === FALSE) { throw new \Exception("Cannot write the cache... Do you have the right permissions ?"); }