Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#13 | mailhandler-1812368-13.patch | 1.76 KB | Dane Powell |
#6 | sample_message.txt | 3.53 KB | lixiphp |
#1 | 1812368-fix_MailhandlerCommandsHeaders_process_value.patch | 919 bytes | lixiphp |
Comments
Comment #1
lixiphp CreditAttribution: lixiphp commentedUpload the patch to check the else condition is string or is array.
Comment #2
Dane Powell CreditAttribution: Dane Powell commentedComment #3
Dane Powell CreditAttribution: Dane Powell commentedCan 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.
Comment #4
lixiphp CreditAttribution: lixiphp commented#1: 1812368-fix_MailhandlerCommandsHeaders_process_value.patch queued for re-testing.
Sorry Dane, click error. will double check the patch in the Test.
Comment #6
lixiphp CreditAttribution: lixiphp commentedHi 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:
There are more messages, you can check this link: design-l.v2 mbox
Many thanks the mbox messages from sponsor architexturez
Comment #7
Dane Powell CreditAttribution: Dane Powell commentedTrying 7.x-2.x-dev to see if it helps tests pass.
Comment #8
Dane Powell CreditAttribution: Dane Powell commented#1: 1812368-fix_MailhandlerCommandsHeaders_process_value.patch queued for re-testing.
Comment #9
lixiphp CreditAttribution: lixiphp commentedHi Dane, can you review the patch results and commit the patch?
Thanks.
Comment #10
Dane Powell CreditAttribution: Dane Powell commentedI'll try to take care of this tomorrow.
Comment #11
Dane Powell CreditAttribution: Dane Powell commented... 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.
Comment #12
Dane Powell CreditAttribution: Dane Powell commentedGot the dev environment up and running, but ran into a new issue: #1849156: Extended headers not saved
Comment #13
Dane Powell CreditAttribution: Dane Powell commentedYour 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.
Comment #14
lixiphp CreditAttribution: lixiphp commentedHi 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.
Comment #15
Dane Powell CreditAttribution: Dane Powell commentedComment #16
kscheirerIf 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?
Comment #17
Dane Powell CreditAttribution: Dane Powell commentedAgreed, 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.
Comment #18
Dane Powell CreditAttribution: Dane Powell commented