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; } }