[#8346] $conf['mailformat']['brokenrfc2231'] doesnt work, bug in Part.php
Summary $conf['mailformat']['brokenrfc2231'] doesnt work, bug in Part.php
Queue Horde Framework Packages
Queue Version FRAMEWORK_3
Type Bug
State Resolved
Priority 2. Medium
Owners Michael Slusarz <slusarz (at) horde (dot) org>
Requester harakiri_23 (at) yahoo (dot) com
Created 06/15/09 (268 days ago)
Due
Updated 06/17/09 (266 days ago)
Assigned 06/16/09 (267 days ago)
Resolved 06/17/09 (266 days ago)
Attachments
Milestone
Patch No

History
06/17/09 Michael Slusarz Comment #3
State ⇒ Resolved
Reply to this comment
Fixed in FW_3.  This was fixed in Horde 4 previously due to the MIME rewrite.
06/17/09 CVS Commit Comment #2 Reply to this comment
06/16/09 Jan Schneider State ⇒ Assigned
Assigned to Michael Slusarz
 
06/15/09 harakiri_23 (at) yahoo (dot) com Comment #1
State ⇒ Unconfirmed
Patch ⇒
Milestone ⇒
Queue ⇒ Horde Framework Packages
Summary ⇒ $conf['mailformat']['brokenrfc2231'] doesnt work, bug in Part.php
Type ⇒ Bug
Priority ⇒ 2. Medium
Reply to this comment
The workaround for the option brokenrfc2231 doesnt work, for longer 
filenames at least (>50?).



The check (strpos($encode_2231, '*=') !== false)) will never return 
true, simply because



$encode_2231 = MIME::encodeRFC2231($key, $value, $charset);



will not result in *= but in *0= *1= etc - an encoded string looks like this:



name*0="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";

     
name*1="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";

     
name*2="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";

     name*3="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.pdf"



there is no name*= for longer filenames. Only for shorter



Fix:



replace if with



if (!empty($GLOBALS['conf']['mailformat']['brokenrfc2231']) &&

                 ((strpos($encode_2231, '*=') !== false) || 
(strpos($encode_2231, '*0=') !== false))) {

                 $ctype .= '; ' . $key . '="' . MIME::encode($value, 
$charset) . '"';

             }



in both places