SSilence / php-imap-client

a easy solution for simple IMAP email access in php
MIT License
268 stars 138 forks source link

[BUG] Empty section subtype value in IncomingMessage::getBody() causes bad, uncatchable error. #225

Open giuspe opened 6 years ago

giuspe commented 6 years ago

Bug See here: https://github.com/SSilence/php-imap-client/blob/a897a58f99638ab60536e947073d497e8154cb12/ImapClient/IncomingMessage.php#L365

image

While parsing message body it can happen (happened to me :) that the (parsed) section subtype is empty, resulting in a bad (uncatchable) error in the following lines (all the

$objNew->$subtype

calls are bound to fail badly).

A first workaround would be at least check for empty $subtype, and exclude the whole following section if is actually empty

image

(I have the fixed branch in my local system, I'll try to push + pull request in a few hours).

mattparksjr commented 6 years ago

Thanks. Ill be there with you open the pr!