Edit report at https://pear.php.net/bugs/bug.php?id=16527&edit=1
ID: 16527
Updated by: daniel.oconnor@gmail.com
Reported By: amrnablus at gmail dot com
Summary: missing parenthesis cause the last part of message to
be parsed wrong
-Status: Open
+Status: Duplicate
Type: Bug
Package: Net_IMAP
Operating System: all
Package Version: 1.1.0
PHP Version: Irrelevant
Roadmap Versions:
New Comment:
-Status: Open
+Status: Duplicate
Previous Comments:
------------------------------------------------------------------------
[2010-08-23 09:57:18] olleolleolle
This issue has been double-reported. See the following issue description
for an very alike follow-up fix:
http://pear.php.net/bugs/bug.php?id=16891
------------------------------------------------------------------------
[2009-08-30 09:21:16] samwilson
I have applied this patch and can confirm that it works.
------------------------------------------------------------------------
[2009-08-17 12:25:53] amrnablus
check this out ,
fetch the message from server with nc
1 fetch 1 (FLAGS UID INTERNALDATE RFC822.SIZE body.peek[header.fields
(From To Subject )]) body[2]
* 1 FETCH (FLAGS () UID 948 INTERNALDATE "06-Aug-2009 12:55:12 +0000"
RFC822.SIZE 939 BODY[HEADER.FIELDS (FROM TO SUBJECT)] {154}
Subject: =?UTF-8?B?SGk=?=
From: =?UTF-8?B?Iklzc2EgRmFraG91cnkiPGlzc2FfZmFraG91cnlAbWFrdG9vYi4=?=
=?UTF-8?B?Y29tPg==?=
To: undisclosed-recipients:;
)
sample script:
$imap = new Net_IMAP( $host );
$imap->login( $user , $password );
$ids = array( "1" );//, "5" );
$uidString = implode( "," , $ids );
$res = $imap->cmdFetch( $uidString , "(FLAGS UID INTERNALDATE
RFC822.SIZE body.peek[header.fields (From To Subject X-Maktoob)])
body[2]" );
var_dump( $res['PARSED'] );die( );
the output without the fix ( note ["CONTENT_SIZE"] )
array(1) {
[0]=>
array(3) {
["COMMAND"]=>
string(5) "FETCH"
["NRO"]=>
string(1) "1"
["EXT"]=>
array(5) {
["FLAGS"]=>
array(0) {
}
["UID"]=>
string(3) "948"
["INTERNALDATE"]=>
string(26) "06-Aug-2009 12:55:12 +0000"
["RFC822.SIZE"]=>
string(3) "939"
["BODY[HEADER.FIELDS (FROM TO SUBJECT X-MAKTOOB)]"]=>
array(2) {
["CONTENT"]=>
string(154) "4}
Subject: =?UTF-8?B?SGk=?=
From: =?UTF-8?B?Iklzc2EgRmFraG91cnkiPGlzc2FfZmFraG91cnlAbWFrdG9vYi4=?=
=?UTF-8?B?Y29tPg==?=
To: undisclosed-recipients:;"
["CONTENT_SIZE"]=>
string(189) "154}
Subject: =?UTF-8?B?SGk=?=
From: =?UTF-8?B?Iklzc2EgRmFraG91cnkiPGlzc2FfZmFraG91cnlAbWFrdG9vYi4=?=
=?UTF-8?B?Y29tPg==?=
To: undisclosed-recipients:;
)
"0006 OK Fetch completed.
}
}
}
output after the fix is applied
array(1) {
[0]=>
array(3) {
["COMMAND"]=>
string(5) "FETCH"
["NRO"]=>
string(1) "1"
["EXT"]=>
array(5) {
["FLAGS"]=>
array(0) {
}
["UID"]=>
string(3) "948"
["INTERNALDATE"]=>
string(26) "06-Aug-2009 12:55:12 +0000"
["RFC822.SIZE"]=>
string(3) "939"
["BODY[HEADER.FIELDS (FROM TO SUBJECT X-MAKTOOB)]"]=>
array(2) {
["CONTENT"]=>
string(154) "Subject: =?UTF-8?B?SGk=?=
From: =?UTF-8?B?Iklzc2EgRmFraG91cnkiPGlzc2FfZmFraG91cnlAbWFrdG9vYi4=?=
=?UTF-8?B?Y29tPg==?=
To: undisclosed-recipients:;
"
["CONTENT_SIZE"]=>
string(3) "154"
}
}
}
}
------------------------------------------------------------------------
[2009-08-16 16:15:12] doconnor
Got a test script? Otherwise it's pretty hard to judge the affect /
value of your changes for us not familiar with the package.
------------------------------------------------------------------------
[2009-08-16 09:05:05] amrnablus
Description:
------------
when fetching a message part, the code that searches for the brace has
missing parenthesis which causes size and the body to be parsed in a
wrong way ...
------------------------------------------------------------------------