Skip to content

Commit

Permalink
fix file permissions when creating cache files. fixes cakephp#2080.
Browse files Browse the repository at this point in the history
  • Loading branch information
0x20h committed Oct 11, 2011
1 parent e894ab2 commit 0938d01
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cake/libs/cache/file.php
Expand Up @@ -141,10 +141,11 @@ function write($key, &$data, $duration) {

$expires = time() + $duration;
$contents = $expires . $lineBreak . $data . $lineBreak;
$old = umask(0);
$handle = fopen($this->__File->path, 'a');
umask($old);

if (!$handle = fopen($this->__File->path, 'a')) {
return false;
}
if (!$handle) return false;

if ($this->settings['lock']) {
flock($handle, LOCK_EX);
Expand Down

0 comments on commit 0938d01

Please sign in to comment.