Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.2.1

Bug #13557 UPPERCASE headers with getHeaders()
Submitted: 2008-04-01 21:25 UTC
From: samwilson Assigned:
Status: Bogus Package: Mail_IMAPv2 (version 0.2.0)
PHP Version: 5.2.3 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2008-04-01 21:25 UTC] samwilson (Sam Wilson)
Description: ------------ The headers returned from Mail_IMAPv2::getHeaders() are all uppercase. Is this a design feature? I might just be missing something, but I've read the docs and can't figure out how to get the original casing of the subject etc. (other than by parsing the raw headers, which seems a little counter-productive). This is a great class in every other way, I must add. Thank you. Test script: --------------- $message_id = 1; // $imap is a connected Mail_IMAPv2 object. $imap->getHeaders($message_id); $headers = $imap->header; var_dump($headers); Expected result: ---------------- array(1) { [1]=> array(37) { .... ["subject"]=> string(10) "TEST EMAIL" .... ["toaddress"]=> string(32) "SAM WILSON <SAM@XXXXXXXXXXX.COM>" ... } } Actual result: -------------- array(1) { [1]=> array(37) { .... ["subject"]=> string(10) "Test eMail" .... ["toaddress"]=> string(32) "Sam Wilson <sam@xxxxxxxxxxx.com>" ... } }

Comments

 [2008-04-01 22:28 UTC] samwilson (Sam Wilson)
I have fixed this, as far as my use requires, by replacing ~line 1530 of Mail_IMAPv2.php: From: // Decode all the headers using utf8_decode(imap_utf8()) $this->header[$mid][$key] = utf8_decode(imap_utf8($value)); To: $current_header = imap_mime_header_decode($value); $this->header[$mid][$key] = $current_header[0]->text; This may break something else, I'm not sure, but it does solve the uppercase subject issue.
 [2008-04-01 23:05 UTC] samwilson (Sam Wilson)
Okay, so I've actually changed it to: $current_header = imap_mime_header_decode($value); if (count($current_header)>0) { $current_header_text = ""; foreach ($current_header as $header_part) { $current_header_text .= $header_part->text; } $this->header[$mid][$key] = $current_header_text; }
 [2013-03-16 21:21 UTC] richy (Richard York)
-Status: Open +Status: Bogus
This does not occur in my tests.