[imp] $conf['mailformat']['brokenrfc2231'] doesnt work, bug in Part.php

Harakiri harakiri_23 at yahoo.com
Fri Jun 12 15:07:18 UTC 2009


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




      


More information about the imp mailing list