From:             
Operating system: Linux
PHP version:      5.3.3
Package:          IMAP related
Bug Type:         Bug
Bug description:imap_mime_header_decode() doesn't ignore \t during long MIME 
header unfolding

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 bug report at http://bugs.php.net/bug.php?id=53377&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=53377&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=53377&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=53377&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=53377&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53377&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=53377&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=53377&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=53377&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=53377&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=53377&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=53377&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=53377&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=53377&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=53377&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53377&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53377&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=53377&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=53377&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=53377&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=53377&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=53377&r=mysqlcfg

Reply via email to