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: Open
Type: Bug
Package: Mail_mimeDecode
Operating System: Linux
Package Version: 1.5.1
PHP Version: 5.2.12
Roadmap Versions:
New Comment:
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);
?>
Previous Comments:
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------