From 54f1cb9d346085176ef39953aa40a2278184e8c1 Mon Sep 17 00:00:00 2001 From: rugk Date: Tue, 21 Jun 2016 21:47:03 +0200 Subject: [PATCH] Only protect file if it was written --- lib/persistence.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/persistence.php b/lib/persistence.php index ed82720f..38b47a79 100644 --- a/lib/persistence.php +++ b/lib/persistence.php @@ -116,10 +116,10 @@ abstract class persistence self::_initialize(); $file = self::$_path . DIRECTORY_SEPARATOR . $filename; $writtenBytes = @file_put_contents($file, $data, LOCK_EX); - chmod($file, 0640); // protect file access if ($writtenBytes === false || $writtenBytes < strlen($data)) { throw new Exception('unable to write to file ' . $file, 13); } + chmod($file, 0640); // protect file access return $file; } }