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

Bug #7676 Content-Type decoding isn't compliant with RFC 2045
Submitted: 2006-05-19 21:22 UTC Modified: 2007-02-12 16:16 UTC
From: priappub at yahoo dot fr Assigned:
Status: Analyzed Package: Mail_mimeDecode (version 1.3.1)
PHP Version: 5.1.4 OS: ALL
Roadmaps: 1.6.0    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: priappub at yahoo dot fr
New email:
PHP Version: Package Version: OS:

 

 [2006-05-19 21:22 UTC] priappub at yahoo dot fr (PRIAP)
Description: ------------ The RFC 2045 says: "Default RFC 822 messages without a MIME Content-Type header are taken by this protocol to be plain text in the US-ASCII character set, which can be explicitly specified as: Content-type: text/plain; charset=us-ascii This default is assumed if no Content-Type header field is specified. It is also recommend that this default be assumed when a syntactically invalid Content-Type header field is encountered." In function _decode, if there is no Content-Type, it's OK, we have: $ctype = explode('/', $default_ctype); $return->ctype_primary = $ctype[0]; $return->ctype_secondary = $ctype[1]; But if we have "Content-Type: text" which is not RFC compliant, we haven't this piece of code and ctype_secondary isn't defined.

Comments

 [2006-05-19 21:56 UTC] priappub at yahoo dot fr
The RFC 2045 says: "Default RFC 822 messages without a MIME Content-Type header are taken by this protocol to be plain text in the US-ASCII character set, which can be explicitly specified as: Content-type: text/plain; charset=us-ascii This default is assumed if no Content-Type header field is specified. It is also recommend that this default be assumed when a syntactically invalid Content-Type header field is encountered." In function _decode, if there is no Content-Type, it's OK, we have: $ctype = explode('/', $default_ctype); $return->ctype_primary = $ctype[0]; $return->ctype_secondary = $ctype[1]; But if we have for exemple "Content-Type: text" which is not RFC compliant, we haven't this piece of code. ctype_primary and ctype_secondary are not defined. I suggest on line 318: default: $ctype = explode('/', $default_ctype); $return->ctype_primary = $ctype[0]; $return->ctype_secondary = $ctype[1]; ...
 [2006-05-19 22:09 UTC] priappub at yahoo dot fr
I have no brain, it's on line 245: if (preg_match('/([0-9a-z+.-]+)\/([0-9a-z+.-]+)/i', $content_type['value'], $regs)) { $return->ctype_primary = $regs[1]; $return->ctype_secondary = $regs[2]; } // Content type != type "/" subtype else { $ctype = explode('/', $default_ctype); $return->ctype_primary = $ctype[0]; $return->ctype_secondary = $ctype[1]; } ...