#48219 [NEW]: POST data is not decoded, according to Content-Transfer-Encoding
| From: | carsten_sttgt at gmx dot de | Date: | Sun, 10 May 2009 10:49:29 +0000 |
| Subject: | #48219 [NEW]: POST data is not decoded, according to Content-Transfer-Encoding | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-137098@lists.php.net to get a copy of this message | ||
From: carsten_sttgt at gmx dot de
Operating system: Windows_NT
PHP version: 5.2.9
PHP Bug Type: HTTP related
Bug description: POST data is not decoded, according to Content-Transfer-Encoding
Description:
------------
Hallo,
In a HTTP POST request and Content-Type "multipart/form-data", each part
can have a Content-Transfer-Encoding, which is defined in RFC2045. (See
also HTML 4.01-sec17.13.4.2)
PHP only works with 7bit, 8bit and binary, because with these values, the
data is not transformed.
With base64 or quoted-printabled, the data is transformed (encoded), and
PHP should decode it (see also rfc2616-sec3.7.2 / rfc1867-sec3.3).
Just test the above example from RFC2388-sec4.5. That's also a problem, if
you upload a file with such a transfer encoding. After move_uploaded_files,
the content of such file is not really what you aspect.
And in a script, which receives such data, I don't see (can't know), if
there was a Content-Transfer-Encoding for something in $_POST / $_FILES.
Maybe not usual, but a Client can use such a Content-Transfer-Encoding at
any time in a POST request.
Regards,
Carsten
Reproduce code:
---------------
Create a simple "test.php" in your DocumentRoot:
==================
<?php
var_dump($_POST);
?>
==================
Telnet to localhost:80 and send this request:
======================================================
POST http://localhost/test.php HTTP/1.0
Content-Length: 181
Content-Type: multipart/form-data; boundary=AaB03x
--AaB03x
Content-Disposition: form-data; name="field1"
Content-Type: text/plain;charset=windows-1250
Content-Transfer-Encoding: quoted-printable
Joe owes =80100.
--AaB03x--
======================================================
Expected result:
----------------
array(1) {
["field1"]=>
string(14) "Joe owes 100."
}
Actual result:
--------------
array(1) {
["field1"]=>
string(16) "Joe owes =80100."
}
--
Edit bug report at http://bugs.php.net/?id=48219&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48219&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48219&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48219&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48219&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48219&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48219&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48219&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48219&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48219&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48219&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48219&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48219&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48219&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48219&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48219&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48219&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48219&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48219&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48219&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48219&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48219&r=mysqlcfg