SSilence / php-imap-client

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

Bug when saving message body and converting with imap_base64() #196

Open wp-entwickler-at opened 6 years ago

wp-entwickler-at commented 6 years ago

Bug

See here: https://github.com/SSilence/php-imap-client/blob/master/ImapClient/IncomingMessage.php#L701 grafik

During the assigning of the message body to the class property it could happen that you assign NULL or ERROR! E.G:

$this->message->$typeMessage->body
// translates into
$this->message->plain->body

If $this->message->$typeMessage->body is empty or no base64 value, than the class property would be assigned with NULL or ERROR.

Problem is, that a mail can consist of more than one $this->message->plain->body. Unusual, but it happens. So the latter Plain-Message overwrites all the Message-Bodys from before. And if the latter one is empty or no base64-string, the class value would be empty!

The solution is to check if imap_base64( $this->message->$typeMessage->body ) is empty or false.

mattparksjr commented 6 years ago

Hi! Thanks for your report. In order to give you proper credit for your fix, would you mind opening a pull request?

mattparksjr commented 6 years ago

I need you to create a commit or let me push this fix myself. @wp-entwickler-at