zhuguoxi / php-mime-mail-parser

Automatically exported from code.google.com/p/php-mime-mail-parser
0 stars 0 forks source link

Fails to decode content encoding when "content-transfer-encoding" header does not contain value in all lower case #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Take an existing stored email in a file which is encoded in quoted-printable 
or base64 and parses correctly and find the "content-transfer-encoding" header.
2. Modify its value from "quoted-printable" or "base64" to "Quoted-Printable" 
or "Base64"
3. Parse the mail and display the part which is encoded

What is the expected output? What do you see instead?
You should see property decoded data. What you see instead is data still in 
it's quoted-printable or base64 encoding

What version of the product are you using? On what operating system?
MimeMailParser.class.php r16
PHP 5.3.2-1ubuntu4.5 with Suhosin-Patch (cli) (built: Sep 17 2010 13:49:46) 
Ubuntu 10.04.1 LTS
Linux 2.6.32-25-generic

Please provide any additional information below.
The RFC states that values for content-transfer-encoding are case insensitive : 
http://tools.ietf.org/html/rfc2045#section-6.1

I'm attaching a patch which fixes this problem by 'strtolower' the value before 
comparison to account for case insensitivity. It updated the private "decode" 
method. 

Original issue reported on code.google.com by gene.wood.temp on 21 Oct 2010 at 9:49

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by gene.wood.temp on 22 Oct 2010 at 4:09

Attachments:

GoogleCodeExporter commented 9 years ago
I've committed this patch into trunk as of r20
This issue should be resolved. Feel free to test and comment or Verify the fix.

Original comment by gene.wood.temp on 22 Oct 2010 at 4:13