Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.6

Bug #4739 Mail_MimeDecode: d_parameters['filename'] missing
Submitted: 2005-07-04 14:56 UTC
From: cm at data-consult dot de Assigned: alan_k
Status: Closed Package: Mail_mimeDecode
PHP Version: 4.3.10 OS: Debian Sarge
Roadmaps: 1.6.0    
Subscription  


 [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.

Comments

 [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).
 [2006-04-27 14:34 UTC] cipri (Cipriano Groenendal)
Moved to Mail_MimeDecode subpackage.
 [2010-08-24 17:51 UTC] sabya (Sabyasachi Ruj)
I am also facing this problem with ctype_parameters being missing. Try to process a mail which has an attachment with the name: "AbcdAbcdAbc'dA.txt" The ctype_parameters['name'] will not be defined.
 [2010-08-25 06:20 UTC] alan_k (Alan Knowles)
-Status: Open +Status: Verified
Patches welcome To fix this a file of an example message would help alot.
 [2010-09-02 16:16 UTC] alan_k (Alan Knowles)
-Status: Verified +Status: Closed -Assigned To: +Assigned To: alan_k
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/