From 6791e44be45744387147535e44e3bbe14d8dfee1 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 10 Mar 2005 00:22:47 +0000 Subject: [PATCH] Fixed bug in ISSO::Mail::_convert_line_breaks where line breaks were in some cases being converted twice. The problem was that if you wanted to convert to \r\n you can't convert in a linear fashion (do all of the conversions to \r\n). Instead, you have to simplify everything to one line break, and then change the line breaks to the desired style. This is because \r\n would be converted into double line breaks if the old style was already \r\n. --- mail.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mail.php b/mail.php index 8cc168a..cd45eef 100644 --- a/mail.php +++ b/mail.php @@ -156,7 +156,10 @@ class Mail */ function _convert_line_breaks($text, $convert_to = "\n") { - return preg_replace("#(\r|\n|\r\n)#s", $convert_to, trim($text)); + $text = trim($text); + $text = str_replace(array("\r\n", "\r", "\n"), "\n", $text); + $text = str_replace("\n", $convert_to, $text); + return $text; } } -- 2.43.5