Hi, When I used Mailhandler in our project, I find:
if (in_array($key, array('to', 'from', 'reply_to', 'sender', 'cc', 'bcc', 'return_path'))) {
...
else {
$message[$key] = iconv_mime_decode($value, 0, "UTF-8");
}

where $value is just for string, if the $value is array, there will happen an error.

I will post the patch in the next nodes.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lixiphp’s picture

Upload the patch to check the else condition is string or is array.

Dane Powell’s picture

Status: Active » Needs review
Dane Powell’s picture

Status: Needs review » Postponed (maintainer needs more info)

Can you please provide a sample message that causes this error? Specifically, what is your $key and $value? We already check for common $keys that might be arrays (to/from/sender/cc addresses, etc...)

The fix is probably fine, but I want to add a simpletest for this before committing it.

lixiphp’s picture

Status: Postponed (maintainer needs more info) » Needs review

#1: 1812368-fix_MailhandlerCommandsHeaders_process_value.patch queued for re-testing.

Sorry Dane, click error. will double check the patch in the Test.

Status: Needs review » Needs work

The last submitted patch, 1812368-fix_MailhandlerCommandsHeaders_process_value.patch, failed testing.

lixiphp’s picture

FileSize
3.53 KB

Hi Dane, thanks for your reviewing.

I attach the simple messages by file sample_message.txt

the arrays keys except (to/from/sender/cc addresses, etc...) there is a field named "References".

References in the messages should be an array:

<E1CaGxG-0001RX-00@blount.mail.mindspring.net>
<74CAAE7F-447E-11D9-9CF6-0003936C456C@electronetwork.org>
<E1CaGxG-0001RX-00@blount.mail.mindspring.net>
<E1CaOvN-0007GF-00@blount.mail.mindspring.net>

There are more messages, you can check this link: design-l.v2 mbox

Many thanks the mbox messages from sponsor architexturez

Dane Powell’s picture

Version: 7.x-2.5 » 7.x-2.x-dev

Trying 7.x-2.x-dev to see if it helps tests pass.

Dane Powell’s picture

Status: Needs work » Needs review
lixiphp’s picture

Assigned: lixiphp » Unassigned

Hi Dane, can you review the patch results and commit the patch?

Thanks.

Dane Powell’s picture

I'll try to take care of this tomorrow.

Dane Powell’s picture

... which clearly didn't happen, sorry. The problem is that my development environment is currently broken, waiting on #1848848: Remove calls to drush_backend_invoke(). I need to add a corresponding test to this patch before I can commit it.

Dane Powell’s picture

Status: Needs review » Postponed

Got the dev environment up and running, but ran into a new issue: #1849156: Extended headers not saved

Dane Powell’s picture

Priority: Critical » Major
Status: Postponed » Needs work
FileSize
1.76 KB

Your patch in #1 does not work with the message in #6, because the references list is not being fetched correctly by the PHP IMAP library in the first place. If you look at the header returned by imap_headerinfo() (see attached patch), you'll see that only one reference is returned. So either your message is malformed, or the PHP IMAP library is misbehaving.

lixiphp’s picture

Hi Dane, I think that is PHP IMAP library issues. I use the PEAR MBOX to retrieve the email elements, which can get the references correctly.

I was plan to realease the PEAR MBOX retrieve library as a new module.

Please give me the credit of this patch.

Thanks for your time.

Dane Powell’s picture

Priority: Major » Normal
Status: Needs work » Needs review
kscheirer’s picture

Issue summary: View changes
Status: Needs review » Postponed (maintainer needs more info)

If PHP Imap isn't returning an array, then this fix wouldn't do very much. The patch looks harmless enough, but seems like a waste until that gets resolved. Postponed until php imap gets an update?

Dane Powell’s picture

Agreed, the patch seems harmless enough but it sounds like it's only actually useful for @lixiphp's custom retrieval library. PHP IMAP users (i.e. all current users of Mailhandler) won't benefit from it. Lixiphp, if you'd like to contribute that retrieval library, then we can reconsider this patch. Thanks.

Dane Powell’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)