PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Mail » Mail_mimeDecode » Bug #4739

Mail_MimeDecode: d_parameters['filename'] missing

Details

Submitted2005-07-04 14:56 UTC
Fromcm at data-consult dot de
Assignedalan_k
StatusClosed
PackageMail_mimeDecode
PHP Version4.3.10
OSDebian Sarge
Roadmaps1.6.0

Comments

[2005-07-04 14:56 UTC] cm at data-consult dot de

Description:
------------
Sometimes the d_parameters['filename'] or ['name'] is missing with the attachment. this happens with utf8 encoded filenames(mostly from M$ clients it seems). without filename im unable to save the file. below is the samplecode i use to save the attachments. i have a testsuite with about 900 mails and this problem exists with more than 10% of these.

i've tried this with and without utf8_decode, but the variables are always empty.

Reproduce code:
---------------
if (isset($part->disposition) and ($part->disposition=='attachment')) {
printf(utf8_decode($part->ctype_parameters['name'])."\n");
printf(utf8_decode($part->ctype_parameters['filename'])."\n");
$attachmentfile = fopen($datedir."/".utf8_decode($part->ctype_parameters['name']), 'w');
fwrite($attachmentfile, $part->body);
fclose($attachmentfile);

}

Expected result:
----------------
this is the print_r($part):

stdClass Object
(
[headers] => Array
(
[content-type] => application/PDF
[content-disposition] => attachment; filename="Auftragsbestätigung_SO_1312338.pdf"
[content-transfer-encoding] => base64
)

[ctype_primary] => application
[ctype_secondary] => PDF
[disposition] => attachment
[d_parameters] => Array
(
[filename] => Auftragsbestätigung_SO_1312338.pdf
)

[body] => %PDF-1.4M%âãÏÓM

so the filename parameter is there.

Actual result:
--------------
but when i use
printf($part->ctype_parameters['filename']."\n");

this variable is empty.

[2005-12-16 23:42 UTC] chris at deskpro dot com

I am coming across this problem as well, however in the cases where I find this missing I am finding a ctype_paramters that has the name in it.

I am finding this problem on inline attachments in Outlook (e.g. background images).