Edit report at http://pear.php.net/bugs/bug.php?id=17325&edit=1
ID: 17325
Updated by: [email protected]
Reported By: hirakawa at ba-z dot co dot jp
Summary: Can't parse messages without a blank line
Status: Closed
Type: Bug
Package: Mail_mimeDecode
Operating System: Linux
Package Version: 1.5.1
PHP Version: 5.2.12
Assigned To: alan_k
Roadmap Versions:
New Comment:
I have checked your change. No problem!
Thank you for your prompt attention!
Previous Comments:
------------------------------------------------------------------------
[2010-04-21 05:49:07] alan_k
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: alan_k
This bug has been fixed in SVN.
If this was a documentation problem, the fix will appear on
pear.php.net by the end of next Sunday (CET).
If this was a problem with the pear.php.net website, the change should
be live shortly.
Otherwise, the fix will appear in the package's next release.
Thank you for the report and for helping us make PEAR better.
I've fixed in svn - can you check the change I made was valid - rather
than just
checking it's a string, I've made the assumption that at least one line
of headers is
required.
------------------------------------------------------------------------
[2010-04-20 06:30:01] hirakawa
Sorry, the script is a little wrong:
<?php
require_once 'mimeDecode.php';
$with_blank = <<<WITH_BLANK
Date: Tue, 20 Apr 2010 13:19:50 +0900
From: Goichi Hirakawa <[email protected]>
To: Goichi Hirakawa <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
WITH_BLANK;
$without_blank = <<<WITHOUT_BLANK
Date: Tue, 20 Apr 2010 13:19:50 +0900
From: Goichi Hirakawa <[email protected]>
To: Goichi Hirakawa <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
WITHOUT_BLANK;
$params = array(
'input' => $with_blank,
'include_bodies' => true,
'decode_bodies' => true,
'decode_headers' => true,
'rfc_822bodies' => true
);
$structure = Mail_mimeDecode::decode($params);
var_dump($structure);
$params = array(
'input' => $without_blank,
'include_bodies' => true,
'decode_bodies' => true,
'decode_headers' => true,
'rfc_822bodies' => true
);
$structure = Mail_mimeDecode::decode($params);
var_dump($structure);
?>
------------------------------------------------------------------------
[2010-04-20 06:14:11] hirakawa
Added #patch bug:17325;patch:Mail_Mime.diff;revision:1271744051;.
------------------------------------------------------------------------
[2010-04-20 06:09:30] hirakawa
Description:
------------
_splitBodyHeader() can't parse messages without a blank line.
According to RFC 5322, "CRLF body" is optional in message:
message = (fields / obs-fields)
[CRLF body]
Test script:
---------------
<?php
require_once 'mimeDecode.php';
$with_blank = <<<WITH_BLANK
Date: Tue, 20 Apr 2010 13:19:50 +0900
From: Goichi Hirakawa <[email protected]>
To: Goichi Hirakawa <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
WITH_BLANK;
$without_blank = <<<WITHOUT_BLANK
Date: Tue, 20 Apr 2010 13:19:50 +0900
From: Goichi Hirakawa <[email protected]>
To: Goichi Hirakawa <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
WITHOUT_BLANK;
$params = array(
'input' => $with_blank,
'include_bodies' => true,
'decode_bodies' => true,
'decode_headers' => true,
'rfc_822bodies' => true
);
$structure = Mail_mimeDecode::decode($params);
var_dump($structure);
$params = array(
'input' => $without_blank,
'include_bodies' => true,
'decode_bodies' => true,
'decode_headers' => true,
'rfc_822bodies' => true
);
$structure = Mail_mimeDecode::decode($params);
var_dump($structure);
?>
Expected result:
----------------
Results of var_dump() are equal.
Actual result:
--------------
Results of var_dump() are NOT equal.
------------------------------------------------------------------------