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

Bug #915 Cannot decode MIME when set specific PHP Enviormental value.
Submitted: 2004-02-27 04:33 UTC
From: vishnu76 at dreamwiz dot com Assigned:
Status: Bogus Package: Mail_Mime
PHP Version: 4.3.4 OS: RedHat 7.0
Roadmaps: (Not assigned)    
Subscription  


 [2004-02-27 04:33 UTC] vishnu76 at dreamwiz dot com
Description: ------------ Cannot decode Multipart MIME data at specific case. Many Korean PHP Web Hosting service is setted "magic_quotes_gpc" is true. At that time Mail_MimeDecode::decode() function cannot decode multipart mime data. Reproduce code: --------------- For example, see below mime header. MIME-Version: 1.0 Content-Type: multipart/related; boundary="=_mime_boundary" --=_mime_boundary Content-Type: text/html; charset="euc_kr" Content-Transfer-Encoding: base64 If PHP is setted gpc_magic_quotes is TRUE, above code will be change like under codes. MIME-Version: 1.0 Content-Type: multipart/related; boundary=\"=_mime_boundary\" --=_mime_boundary Content-Type: text/html; charset=\"euc_kr\" Content-Transfer-Encoding: base64 Now, PEAR MIME Package cannot decode Above mime data. Expected result: ---------------- PEAR Package must decode mime data. Actual result: -------------- I have change _parseHeaderValue function in PEAR MIME Package. See Below.. for ($i = 0; $i < count($parameters); $i++) { $param_name = substr($parameters[$i], 0, $pos = strpos($parameters[$i], '=')); $param_value = substr($parameters[$i], $pos + 1); //Debug if(get_magic_quotes_gpc()) $param_value = stripslashes($param_value); //Debug if ($param_value[0] == '"') { $param_value = substr($param_value, 1, -1); } $return['other'][$param_name] = $param_value; $return['other'][strtolower($param_name)] = $param_value; }

Comments

 [2004-02-27 08:21 UTC] neufeind at php dot net
Where from do you get your input mime-data? Is it data sent to your script by a POST-form or something? The name "gpc" explains that normally only data coming from GET, POST or COOKIE should be affected ...
 [2004-02-27 23:44 UTC] justinpatrin
First of all, this should be classified as a bug for Mail_Mime, not the Bug System. Second of all, Mail_Mime does not take any data directly from get, post, of cookies so it does not need to handle magic_quotes_gpc. You should be fixing your strings before you send them to Mail_Mime.