From 4495b9a7ca34d093316209c65226a426b32291b0 Mon Sep 17 00:00:00 2001 From: Tom Sommer Date: Fri, 19 Jun 2015 08:53:46 +0200 Subject: [PATCH] Fix case where imap_fetch_overview() fails and returns empty array --- src/Fetch/Message.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Fetch/Message.php b/src/Fetch/Message.php index 3c042c5..1b2b73d 100755 --- a/src/Fetch/Message.php +++ b/src/Fetch/Message.php @@ -289,6 +289,9 @@ class Message if ($forceReload || !isset($this->messageOverview)) { // returns an array, and since we just want one message we can grab the only result $results = imap_fetch_overview($this->imapStream, $this->uid, FT_UID); + if ( sizeof($results) == 0 ) { + throw new \RuntimeException('Error fetching overview'); + } $this->messageOverview = array_shift($results); if ( ! isset($this->messageOverview->date)) { $this->messageOverview->date = null;