Bug #53377 [Sus->Csd]: imap_mime_header_decode() doesn't ignore \t during long MIME header unfolding
| From: | aharvey@php.net | Date: | Mon, 13 Dec 2010 08:38:07 +0000 |
| Subject: | Bug #53377 [Sus->Csd]: imap_mime_header_decode() doesn't ignore \t during long MIME header unfolding | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-156949@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53377&edit=1
ID: 53377
Updated by: aharvey@php.net
Reported by: up at co dot inbox dot lv
Summary: imap_mime_header_decode() doesn't ignore \t during
long MIME header unfolding
-Status: Suspended
+Status: Closed
Type: Bug
Package: IMAP related
Operating System: Linux
PHP Version: 5.3.3
Assigned To: aharvey
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Merged to 5.3.
Previous Comments:
------------------------------------------------------------------------
[2010-12-13 09:38:03] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=306336
Log: MFH: fixed bug #53377 (imap_mime_header_decode() doesn't ignore \t
during long
MIME header unfolding).
------------------------------------------------------------------------
[2010-11-23 11:36:43] aharvey@php.net
Fixed on trunk. I'll verify that we want this for 5.3.4 before
committing it onto the 5.3 branch, since we're in a release cycle
at present.
------------------------------------------------------------------------
[2010-11-23 11:35:02] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=305686
Log: Fix bug #53377 (imap_mime_header_decode() doesn't ignore \t during
long MIME
header unfolding).
------------------------------------------------------------------------
[2010-11-22 12:48:53] up at co dot inbox dot lv
Description:
------------
Function imap_mime_header_decode() doesn't respect \t (HTAB) characters
marking continuation of header defined in RFC822 as one of the LWSP
chars, however SPACE is still ignored. Source string:
{{{
public 'subject' => string
'=?utf-8?B?V3VzaHUgaW5mb3JtIC0gU2FjZW5zaWJhcyBJZ2F1bmk=?= =?utf-8?B?amEgKFRhbGxpbmEpLCDRgdC+0YDQtdCy0L3QvtCy0LDQvdC40Y8g0LIg0KLQsNC7?= =?utf-8?B?0LvQuNC90LUgMTEg0LTQtdC60LDQsdGA0Y8=?='
(length=182)
}}}
where spaces between =?...?= lines are actually tabs, results to
{{{
array
0 =>
object(stdClass)[54]
public 'charset' => string 'utf-8' (length=5)
public 'text' => string 'Wushu inform - Sacensibas Igauni'
(length=32)
1 =>
object(stdClass)[53]
public 'charset' => string 'default' (length=7)
public 'text' => string ' ' (length=1)
2 =>
object(stdClass)[55]
public 'charset' => string 'utf-8' (length=5)
public 'text' => string 'ja (Tallina),
ÑоÑÐµÐ²Ð½Ð¾Ð²Ð°Ð½Ð¸Ñ Ð²
Тал' (length=48)
3 =>
object(stdClass)[56]
public 'charset' => string 'default' (length=7)
public 'text' => string ' ' (length=1)
4 =>
object(stdClass)[57]
public 'charset' => string 'utf-8' (length=5)
public 'text' => string 'лине 11
декабÑÑ' (length=26)
}}}
This produces:
{{{
Wushu inform - Sacensibas Igauni ja (Tallina), ÑоÑевнованиÑ
в Тал лине 11 декабÑÑ
}}}
with unwanted spaces in words "Igauni ja" and "Тал лине".
Test script:
---------------
$str = "=?utf-8?B?V3VzaHUgaW5mb3JtIC0gU2FjZW5zaWJhcyBJZ2F1bmk=?="
."\t=?utf-8?B?amEgKFRhbGxpbmEpLCDRgdC+0YDQtdCy0L3QvtCy0LDQvdC40Y8g0LIg0KLQsNC7?="
."\t=?utf-8?B?0LvQuNC90LUgMTEg0LTQtdC60LDQsdGA0Y8=?=";
var_dump(imap_mime_header_decode($str));
var_dump(imap_mime_header_decode(str_replace("\t", " ", $str)))
Expected result:
----------------
array
0 =>
object(stdClass)[5]
public 'charset' => string 'utf-8' (length=5)
public 'text' => string 'Wushu inform - Sacensibas Igauni'
(length=32)
1 =>
object(stdClass)[4]
public 'charset' => string 'utf-8' (length=5)
public 'text' => string 'ja (Tallina),
б�аÐб�аÐаÐаÐаÐаÐаÐаÐаÐб�
аРаÐаÐаÐ'
(length=48)
2 =>
object(stdClass)[3]
public 'charset' => string 'utf-8' (length=5)
public 'text' => string 'аÐаÐаÐаР11
аÐаÐаÐаÐаÐб�б�' (length=26)
Actual result:
--------------
array
0 =>
object(stdClass)[1]
public 'charset' => string 'utf-8' (length=5)
public 'text' => string 'Wushu inform - Sacensibas Igauni'
(length=32)
1 =>
object(stdClass)[2]
public 'charset' => string 'default' (length=7)
public 'text' => string ' ' (length=1)
2 =>
object(stdClass)[3]
public 'charset' => string 'utf-8' (length=5)
public 'text' => string 'ja (Tallina),
б�аÐб�аÐаÐаÐаÐаÐаÐаÐаÐб�
аРаÐаÐаÐ'
(length=48)
3 =>
object(stdClass)[4]
public 'charset' => string 'default' (length=7)
public 'text' => string ' ' (length=1)
4 =>
object(stdClass)[5]
public 'charset' => string 'utf-8' (length=5)
public 'text' => string 'аÐаÐаÐаР11
аÐаÐаÐаÐаÐб�б�' (length=26)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53377&edit=1