From a7da18319ddc58073320620259f3d27793093bb8 Mon Sep 17 00:00:00 2001 From: Pascal Baljet Date: Thu, 9 Feb 2023 11:04:07 +0100 Subject: [PATCH] Rescue --- src/Mails/PersistentMailFake.php | 2 +- src/Notifications/PersistentNotificationFake.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mails/PersistentMailFake.php b/src/Mails/PersistentMailFake.php index 6f5147c..400b5f8 100644 --- a/src/Mails/PersistentMailFake.php +++ b/src/Mails/PersistentMailFake.php @@ -30,7 +30,7 @@ public function cleanStorage() public function loadMails(): self { $unserialized = file_exists($this->storage) - ? unserialize(file_get_contents($this->storage)) + ? rescue(fn () => unserialize(file_get_contents($this->storage)), [], false) : []; $this->mailables = $unserialized['mailables'] ?? []; diff --git a/src/Notifications/PersistentNotificationFake.php b/src/Notifications/PersistentNotificationFake.php index ec0e477..da26c6f 100644 --- a/src/Notifications/PersistentNotificationFake.php +++ b/src/Notifications/PersistentNotificationFake.php @@ -30,7 +30,7 @@ public function cleanStorage() public function loadNotifications(): self { $this->notifications = file_exists($this->storage) - ? unserialize(file_get_contents($this->storage)) + ? rescue(fn () => unserialize(file_get_contents($this->storage)), [], false) : []; return $this;