Explorar o código

Set permissions when saving files

Fixes https://github.com/elrido/ZeroBin/issues/80
rugk %!s(int64=10) %!d(string=hai) anos
pai
achega
8a48e9ce78
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      lib/persistence.php

+ 1 - 0
lib/persistence.php

@@ -116,6 +116,7 @@ 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);
         }