summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-10-30 15:28:07 +0100
committerAndrey Andreev <narf@bofh.bg>2012-10-30 15:28:07 +0100
commit936a8fe74fdefe099fceb2c93c2eab22370d8915 (patch)
treecaef50b87f9994dac50ce6b5f97f27dd44df6337
parent7676c2d6761cb3cdeccf005c2a30140f0ba3ced5 (diff)
parente1e956d79384d42a6b1f8d792c9db131874e60c5 (diff)
Merge pull request #1945 from GDmac/develop
Fix #1938
-rw-r--r--system/libraries/Email.php9
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 7 insertions, 3 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index edca303ff..7280466a5 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -770,6 +770,9 @@ class CI_Email {
$body = str_replace(str_repeat("\n", $i), "\n\n", $body);
}
+ // Reduce multiple spaces
+ $str = preg_replace('| +|', ' ', $str);
+
return ($this->wordwrap)
? $this->word_wrap($body, 76)
: $body;
@@ -792,15 +795,15 @@ class CI_Email {
$charlim = empty($this->wrapchars) ? 76 : $this->wrapchars;
}
- // Reduce multiple spaces
- $str = preg_replace('| +|', ' ', $str);
-
// Standardize newlines
if (strpos($str, "\r") !== FALSE)
{
$str = str_replace(array("\r\n", "\r"), "\n", $str);
}
+ // Reduce multiple spaces at end of line
+ $str = preg_replace('| +\n|', "\n", $str);
+
// If the current word is surrounded by {unwrap} tags we'll
// strip the entire chunk and replace it with a marker.
$unwrap = array();
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 5b3ca3e9f..065daf54b 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -400,6 +400,7 @@ Bug fixes for 3.0
- Fixed a bug (#142) - :doc:`Form Helper <helpers/form_helper>` function ``form_dropdown()`` didn't escape HTML entities in option values.
- Fixed a bug (#50) - :doc:`Session Library <libraries/sessions>` unnecessarily stripped slashed from serialized data, making it impossible to read objects in a namespace.
- Fixed a bug (#658) - :doc:`Routing <general/routing>` wildcard **:any** didn't work as advertised and matched multiple URI segments instead of all characters within a single segment.
+- Fixed a bug (#1938) - :doc:`Email <libraries/email>` where the email library removed multiple spaces inside a pre-formatted plain text message.
Version 2.1.3
=============