Bug #53377 [Opn->Sus]: imap_mime_header_decode() doesn't ignore \t during long MIME header unfolding

From: Date: Tue, 23 Nov 2010 10:36:43 +0000
Subject: Bug #53377 [Opn->Sus]: 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-156311@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: Open +Status: Suspended Type: Bug Package: IMAP related Operating System: Linux PHP Version: 5.3.3 -Assigned To: +Assigned To: aharvey Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#156311) next »