From b5e38613811824a6d1b3d1993f37de422087ac6f Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 26 Jan 2021 17:42:09 +0100 Subject: [PATCH 1/2] fix TypeError: fclose(): supplied resource is not a valid stream resource --- src/Storage/Mbox.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Storage/Mbox.php b/src/Storage/Mbox.php index 3e48a6c6..52f6bcfe 100644 --- a/src/Storage/Mbox.php +++ b/src/Storage/Mbox.php @@ -308,7 +308,9 @@ protected function openMboxFile($filename) public function close() { ErrorHandler::start(E_WARNING); - fclose($this->fh); + if (is_resource($this->fh)) { + fclose($this->fh); + } ErrorHandler::stop(); $this->positions = []; } From fd62569b1065b85eadad627e0556376e1696da97 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 26 Jan 2021 17:54:35 +0100 Subject: [PATCH 2/2] clean uneeded stuff --- src/Storage/Mbox.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Storage/Mbox.php b/src/Storage/Mbox.php index 52f6bcfe..c8f16d6e 100644 --- a/src/Storage/Mbox.php +++ b/src/Storage/Mbox.php @@ -307,11 +307,9 @@ protected function openMboxFile($filename) */ public function close() { - ErrorHandler::start(E_WARNING); if (is_resource($this->fh)) { fclose($this->fh); } - ErrorHandler::stop(); $this->positions = []; }