Bug #7676 [Ana->Fbk]: Content-Type decoding isn't compliant with RFC 2045
| From: | alan at akbkhome dot com | Date: | Thu, 02 Sep 2010 12:56:22 +0000 |
| Subject: | Bug #7676 [Ana->Fbk]: Content-Type decoding isn't compliant with RFC 2045 | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-4742@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=7676&edit=1
ID: 7676
Updated by: alan@akbkhome.com
Reported By: priappub at yahoo dot fr
Summary: Content-Type decoding isn't compliant with RFC 2045
-Status: Analyzed
+Status: Feedback
Type: Bug
Package: Mail_mimeDecode
Operating System: ALL
Package Version: 1.3.1
PHP Version: 5.1.4
Roadmap Versions:
New Comment:
-Status: Analyzed
+Status: Feedback
still a bug?
Previous Comments:
------------------------------------------------------------------------
[2006-05-19 23:09:59] 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];
}
...
------------------------------------------------------------------------
[2006-05-19 22:56:14] 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:22:19] priappub at yahoo dot fr
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.
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=7676&edit=1