From 58081593e9d37eb17c687e6ab8a0eb3ec3d36d8a Mon Sep 17 00:00:00 2001 From: David Rothstein Date: Wed, 25 Dec 2013 16:49:17 -0500 Subject: Issue #310315 by superspring, justafish, naxoc, Waltemath | fonant: drupal_wrap_mail() strips trailing blanks from standard hyphen-hyphen-space-newline e-mail signature separator. --- includes/mail.inc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'includes') diff --git a/includes/mail.inc b/includes/mail.inc index bbb55357d..34a4d10fa 100644 --- a/includes/mail.inc +++ b/includes/mail.inc @@ -339,13 +339,13 @@ interface MailSystemInterface { * * We deliberately use LF rather than CRLF, see drupal_mail(). * - * @param $text + * @param string $text * The plain text to process. - * @param $indent (optional) + * @param string $indent (optional) * A string to indent the text with. Only '>' characters are repeated on * subsequent wrapped lines. Others are replaced by spaces. * - * @return + * @return string * The content of the email as a string with formatting applied. */ function drupal_wrap_mail($text, $indent = '') { @@ -356,8 +356,9 @@ function drupal_wrap_mail($text, $indent = '') { $soft = strpos($clean_indent, ' ') === FALSE; // Check if the string has line breaks. if (strpos($text, "\n") !== FALSE) { - // Remove trailing spaces to make existing breaks hard. - $text = preg_replace('/ +\n/m', "\n", $text); + // Remove trailing spaces to make existing breaks hard, but leave signature + // marker untouched (RFC 3676, Section 4.3). + $text = preg_replace('/(?(? $soft, 'length' => strlen($indent))); -- cgit v1.2.3