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

From: Date: Thu, 17 Mar 2005 17:09:26 +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-75442@lists.php.net to get a copy of this message
ID: 32311 Updated by: iliaa@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-16 07:11:03] mortoray at ecircle-ag dot com The snapshop provided does not contain an php_mbstring.dll, and thus this function does not appear to be defined.... (Windows ZIP) ------------------------------------------------------------------------ [2005-03-16 00:58:48] sniper@php.net 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 ------------------------------------------------------------------------ [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 (#75442) next »