From bcaa835898ac4b5ad7ecc240003dbf6013b92e43 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Thu, 8 Feb 2024 12:08:07 +0300 Subject: [PATCH] fixes undefined property --- src/Fetch/Attachment.php | 4 +++- src/Fetch/Message.php | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Fetch/Attachment.php b/src/Fetch/Attachment.php index 2919e20..892c8f0 100644 --- a/src/Fetch/Attachment.php +++ b/src/Fetch/Attachment.php @@ -134,7 +134,9 @@ class Attachment $this->setFileName($parameters['name']); } - $this->size = $structure->bytes; + if (property_exists($structure, 'bytes')) { + $this->size = $structure->bytes; + } $this->mimeType = Message::typeIdToString($structure->type); diff --git a/src/Fetch/Message.php b/src/Fetch/Message.php index 34b6ee7..8374646 100644 --- a/src/Fetch/Message.php +++ b/src/Fetch/Message.php @@ -764,7 +764,13 @@ class Message foreach ($addresses as $address) { if (property_exists($address, 'mailbox') && $address->mailbox != 'undisclosed-recipients') { $currentAddress = array(); - $currentAddress['address'] = $address->mailbox . '@' . $address->host; + + $host = ''; + if (property_exists($address, 'host')) { + $host = $address->host; + } + + $currentAddress['address'] = $address->mailbox . '@' . $host; if (isset($address->personal)) { $currentAddress['name'] = MIME::decode($address->personal, self::$charset); }