#32311 [Opn->Fbk]: mb_encode_mimeheader does not properly escape characters

From: Date: Tue, 15 Mar 2005 23:58:49 +0000
Subject: #32311 [Opn->Fbk]: mb_encode_mimeheader does not properly escape characters
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-77144@lists.php.net to get a copy of this message
ID: 32311 Updated by: sniper@php.net Reported By: mortoray at ecircle-ag dot com -Status: Open +Status: Feedback Bug Type: mbstring related Operating System: Windows2000 PHP Version: 4.3.10 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip Previous Comments: ------------------------------------------------------------------------ [2005-03-15 10:30:51] mortoray at ecircle-ag dot com 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 this bug report at http://bugs.php.net/?id=32311&edit=1

« previous php.bugs (#77144) next »