From af5161a232060b04a8f00e749598849159bfa43b Mon Sep 17 00:00:00 2001 From: Bernhard Breytenbach Date: Tue, 5 Aug 2014 14:52:29 +0200 Subject: [PATCH] Bugfix: Set overview/header date field to null if not set --- src/Fetch/Message.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Fetch/Message.php b/src/Fetch/Message.php index 6a0b8c6..dc58566 100755 --- a/src/Fetch/Message.php +++ b/src/Fetch/Message.php @@ -272,6 +272,9 @@ class Message // 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); $this->messageOverview = array_shift($results); + if ( ! isset($this->messageOverview->date)) { + $this->messageOverview->date = null; + } } return $this->messageOverview; @@ -295,7 +298,12 @@ class Message $headerObject = imap_rfc822_parse_headers($rawHeaders); // to keep this object as close as possible to the original header object we add the udate property - $headerObject->udate = strtotime($headerObject->date); + if (isset($headerObject->date)) { + $headerObject->udate = strtotime($headerObject->date); + } else { + $headerObject->date = null; + $headerObject->udate = null; + } $this->headers = $headerObject; }