From 63a4e2e89948bea8207dfa3c583e40f3d10f143b Mon Sep 17 00:00:00 2001 From: phpnut Date: Sat, 22 Dec 2007 22:17:42 +0000 Subject: [PATCH] "Fixes #3717, Temp files read/write errors under load" git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6205 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/basics.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cake/basics.php b/cake/basics.php index 29fe07077..a34e05992 100644 --- a/cake/basics.php +++ b/cake/basics.php @@ -522,6 +522,7 @@ if (!function_exists('clone')) { if ($write === false) { return false; } else { + @fclose($res); return $write; } } @@ -558,25 +559,23 @@ if (!function_exists('clone')) { $filename = TMP . $path; break; } - $timediff = $expires - $now; $filetime = false; + if (file_exists($filename)) { $filetime = @filemtime($filename); } if ($data === null) { - // Read data from file if (file_exists($filename) && $filetime !== false) { if ($filetime + $timediff < $now) { - // File has expired @unlink($filename); } else { - $data = file_get_contents($filename); + $data = @file_get_contents($filename); } } } elseif (is_writable(dirname($filename))) { - file_put_contents($filename, $data); + @file_put_contents($filename, $data); } return $data; }