Bug #30 in Mail_mime

From: Date: Wed, 05 Apr 2006 14:43:12 +0000
Subject: Bug #30 in Mail_mime
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-42083@lists.php.net to get a copy of this message
Hello everybody, I'm using Mail_mime on a daily basis, but bug #30 disturbs me a lot ( http://pear.php.net/bugs/bug.php?id=30 ). I want to suggest you a patch to fix this issue (see at the bottom of this mail). Maybe someone could fix the bug ? (with my patch or another, I don't care for that) Thanks Nicolas =========================== Patch : in PEAR/Mail/mime.php , replace the function _encodeHeaders with this : function _encodeHeaders($input) { $ns = "[^\(\)<>@,;:\"\/\[\]\r\n]*"; foreach ($input as $hdr_name => $hdr_value) { $input[$hdr_name] = preg_replace_callback("/{$ns}(?:[\\x80-\\xFF]{$ns})+/", array($this, '_encodeHeaderWord'), $hdr_value); } return $input; } function _encodeHeaderWord($word) { $word = preg_replace('/[=_\?\x00-\x1F\x80-\xFF]/e', '"=".strtoupper(dechex(ord("\0")))', $word[0]); preg_match('/^( *)(.*?)( *)$/', $word, $w); $word =& $w[2]; $word = str_replace(' ', '_', $word); $start = '=?' . $this->_build_params['head_charset'] . '?Q?'; $offsetLen = strlen($start) + 2; $w[1] .= $start; while ($offsetLen + strlen($word) > 75) { $splitPos = 75 - $offsetLen; switch ('=') { case substr($word, $splitPos - 2, 1): --$splitPos; case substr($word, $splitPos - 1, 1): --$splitPos; } $w[1] .= substr($word, 0, $splitPos) . "?={$this->_eol} {$start}"; $word = substr($word, $splitPos); } return $w[1] . $word . '?=' . $w[3]; }

« previous php.pear.dev (#42083) next »