From 9c642061fd1528193e593cf46bb9b1ddc8d8293c Mon Sep 17 00:00:00 2001 From: yuan-dian <33216505+yuan-dian@users.noreply.github.com> Date: Wed, 30 Oct 2019 17:51:38 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E6=96=87=E4=BB=B6=E6=97=B6=EF=BC=8C=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/cache/driver/File.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/library/think/cache/driver/File.php b/library/think/cache/driver/File.php index 93d321f232..c0f0671f3d 100644 --- a/library/think/cache/driver/File.php +++ b/library/think/cache/driver/File.php @@ -130,7 +130,7 @@ public function get($name, $default = false) return $default; } - $content = file_get_contents($filename); + $content = @file_get_contents($filename); $this->expire = null; if (false !== $content) { @@ -299,7 +299,11 @@ public function clear($tag = null) */ private function unlink($path) { - return is_file($path) && unlink($path); + try { + return is_file($path) && unlink($path); + } catch (\Exception $e) { + return false; + } } } From 1ae5811dcb019db6b5a10536841db406082ab975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8E=9F=E7=82=B9?= <467490186@qq.com> Date: Mon, 4 Nov 2019 10:37:36 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E6=97=B6=EF=BC=8C=E6=96=87=E4=BB=B6=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/cache/driver/File.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/library/think/cache/driver/File.php b/library/think/cache/driver/File.php index c0f0671f3d..c9894d78ed 100644 --- a/library/think/cache/driver/File.php +++ b/library/think/cache/driver/File.php @@ -129,8 +129,11 @@ public function get($name, $default = false) if (!is_file($filename)) { return $default; } - - $content = @file_get_contents($filename); + try { + $content = file_get_contents($filename); + } catch (\Exception $e) { + return $default; + } $this->expire = null; if (false !== $content) { @@ -245,11 +248,7 @@ public function dec($name, $step = 1) public function rm($name) { $this->writeTimes++; - - try { - return $this->unlink($this->getCacheKey($name)); - } catch (\Exception $e) { - } + return $this->unlink($this->getCacheKey($name)); } /** From b708d616685acead0add2c21ef2e339f4055c986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8E=9F=E7=82=B9?= <467490186@qq.com> Date: Fri, 15 Nov 2019 09:48:33 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BD=BF=E7=94=A8@=E5=B1=8F=E8=94=BD?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=BC=93=E5=AD=98=E8=8E=B7=E5=8F=96=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/cache/driver/File.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/library/think/cache/driver/File.php b/library/think/cache/driver/File.php index c9894d78ed..2e57e9a5c6 100644 --- a/library/think/cache/driver/File.php +++ b/library/think/cache/driver/File.php @@ -129,11 +129,9 @@ public function get($name, $default = false) if (!is_file($filename)) { return $default; } - try { - $content = file_get_contents($filename); - } catch (\Exception $e) { - return $default; - } + + $content = @file_get_contents($filename); + $this->expire = null; if (false !== $content) {