From 3b4761424fdb494262f7f4c215c9dbd19cca53e0 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 9 Oct 2019 13:49:30 +0200 Subject: [PATCH] fix read of 8192 bytes failed with errno=21 Is a directory --- src/Storage/Mbox.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Storage/Mbox.php b/src/Storage/Mbox.php index 30de89cd..8ae352ac 100644 --- a/src/Storage/Mbox.php +++ b/src/Storage/Mbox.php @@ -216,8 +216,8 @@ public function __construct($params) */ protected function isMboxFile($file, $fileIsString = true) { + ErrorHandler::start(E_NOTICE); if ($fileIsString) { - ErrorHandler::start(E_WARNING); $file = fopen($file, 'r'); ErrorHandler::stop(); if (! $file) { @@ -230,15 +230,15 @@ protected function isMboxFile($file, $fileIsString = true) $result = false; $line = fgets($file) ?: ''; + if (strpos($line, 'From ') === 0) { $result = true; } if ($fileIsString) { - ErrorHandler::start(E_WARNING); fclose($file); - ErrorHandler::stop(); } + ErrorHandler::stop(); return $result; }