mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-13 04:04:12 +02:00
Correctly split long subject lines according to the used RFC. This fixes extra spaces within long subjects. (Bug #43715)
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9430 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -1446,9 +1446,10 @@ function mail_encode($str)
|
||||
// define start delimimter, end delimiter and spacer
|
||||
$start = "=?UTF-8?B?";
|
||||
$end = "?=";
|
||||
$spacer = $end . ' ' . $start;
|
||||
$split_length = 64;
|
||||
$delimiter = "\r\n ";
|
||||
|
||||
// Maximum length is 75 for everything. 75 - length of start/end/delimiter == 63
|
||||
$split_length = 63;
|
||||
$encoded_str = base64_encode($str);
|
||||
|
||||
// If encoded string meets the limits, we just return with the correct data.
|
||||
@@ -1460,7 +1461,7 @@ function mail_encode($str)
|
||||
// If there is only ASCII data, we just return what we want, correctly splitting the lines.
|
||||
if (strlen($str) === utf8_strlen($str))
|
||||
{
|
||||
return $start . implode($spacer, str_split($encoded_str, $split_length)) . $end;
|
||||
return $start . implode($end . $delimiter . $start, str_split($encoded_str, $split_length)) . $end;
|
||||
}
|
||||
|
||||
// UTF-8 data, compose encoded lines
|
||||
@@ -1476,10 +1477,10 @@ function mail_encode($str)
|
||||
$text .= array_shift($array);
|
||||
}
|
||||
|
||||
$str .= $start . base64_encode($text) . $end . ' ';
|
||||
$str .= $start . base64_encode($text) . $end . $delimiter;
|
||||
}
|
||||
|
||||
return substr($str, 0, -1);
|
||||
return substr($str, 0, -strlen($delimiter));
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user