php-imap
php-imap copied to clipboard
parseBody() duplicates attachments
Describe the bug
Raw email contains in my case only one attachment, and Message object also, but after calling parseBody() additional attachments is added, the same as first one
Code to Reproduce The troubling code section which produces the reported bug.
$messages = $folder->messages()->all()->fetchOrderAsc()->leaveUnread()->setFetchBody(true)->setFetchOrder($fetchOrder);
$messagePage = $messages->paginate(per_page: $perPage, page: ++$page);
foreach ($messagePage as $message) {
$message->parseBody(); // duplicates attachments
}
Expected behaviour
Only unique attachments are listed in Message
Desktop / Server:
- PHP: 8.2
- Version: 5.5.0