From: mortoray at ecircle-ag dot com
Operating system: Windows2000
PHP version: 4.3.10
PHP Bug Type: mbstring related
Bug description: mb_encode_mimeheader does not properly escape characters
Description:
------------
At least for Q encoding, this function is unsafe and does not encode
correctly. Raw characters which appear as RFC2047 sequences are simply
left as is.
Ex:
mb_encode_mimeheader( '=?iso-8859-1?q?this=20is=20some=20text?=' );
returns '=?iso-8859-1?q?this=20is=20some=20text?='
The exact same string, which is obviously not the encoding for the source
string. That is, mb_encode_mimeheader does not do any type of escaping.
That is, the following condition is not always true:
mb_decode_mimeheader( mb_encode_mimeheader( $text ) ) == $text
Reproduce code:
---------------
$text = '=?iso-8859-1?q?this=20is=20some=20text?=';
assert( mb_decode_mimeheader( mb_encode_mimeheader( $text ) ) == $text );
Expected result:
----------------
The decode/encode sequence should always return the original text.
Actual result:
--------------
Returned result is different than original (that is, the assertion
fails).
--
Edit bug report at http://bugs.php.net/?id=32311&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32311&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32311&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32311&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32311&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32311&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32311&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32311&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32311&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32311&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32311&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32311&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32311&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32311&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32311&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32311&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32311&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32311&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32311&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32311&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32311&r=mysqlcfg