PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Mail » Mail_Mime » Bug #915

Cannot decode MIME when set specific PHP Enviormental value.

Details

Submitted2004-02-27 04:33 UTC
Fromvishnu76 at dreamwiz dot com
StatusBogus
PackageMail_Mime
PHP Version4.3.4
OSRedHat 7.0
Roadmaps(Not assigned)

Comments

[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;
}

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