From 7629ea5c4726bb2fe4b3fa9d57d88cf8de677373 Mon Sep 17 00:00:00 2001 From: Gert van den Buijs Date: Thu, 5 May 2022 09:35:24 +0200 Subject: [PATCH] added extra check before unserialising, when file exists but is corrupted fallback to default before like when the file isn't present and overwrite the corrupt file. --- src/Adapter/Filesystem/FilesystemCachePool.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Adapter/Filesystem/FilesystemCachePool.php b/src/Adapter/Filesystem/FilesystemCachePool.php index 065519d1..a8530994 100644 --- a/src/Adapter/Filesystem/FilesystemCachePool.php +++ b/src/Adapter/Filesystem/FilesystemCachePool.php @@ -159,7 +159,13 @@ protected function getList($name) $this->filesystem->write($file, serialize([])); } - return unserialize($this->filesystem->read($file)); + $data = $this->filesystem->read($file); + if ($data === false) { + $this->filesystem->update($file, serialize([])); + $data = []; + } + + return unserialize($data); } /**