From b4e3c8a77664b7f4b1ae6318a7ba44c401396e6d Mon Sep 17 00:00:00 2001 From: 0x20h Date: Tue, 11 Oct 2011 22:28:46 -0400 Subject: [PATCH] Set umask when creating cache file Fixes #2080 --- cake/libs/cache/file.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cake/libs/cache/file.php b/cake/libs/cache/file.php index 087ba0aa1d5..a77c5626667 100644 --- a/cake/libs/cache/file.php +++ b/cake/libs/cache/file.php @@ -138,9 +138,12 @@ 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']) {