summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-01-20 16:25:13 +0100
committerAndrey Andreev <narf@devilix.net>2016-01-20 16:25:13 +0100
commitc70216d560d85adf907d9941868a0d8d3df868ca (patch)
tree5b8da49275306abbe4684099fd29fcd8c69c4e1a
parent22df06b544cb74b4a71c0e1b0d9fa0bc13c95469 (diff)
Fix #4391
-rw-r--r--system/libraries/Email.php18
-rw-r--r--user_guide_src/source/changelog.rst4
2 files changed, 15 insertions, 7 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 007f9b431..ed6f737a1 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -574,14 +574,18 @@ class CI_Email {
$this->validate_email($this->_str_to_array($replyto));
}
- if ($name === '')
- {
- $name = $replyto;
- }
-
- if (strpos($name, '"') !== 0)
+ if ($name !== '')
{
- $name = '"'.$name.'"';
+ // only use Q encoding if there are characters that would require it
+ if ( ! preg_match('/[\200-\377]/', $name))
+ {
+ // add slashes for non-printing characters, slashes, and double quotes, and surround it in double quotes
+ $name = '"'.addcslashes($name, "\0..\37\177'\"\\").'"';
+ }
+ else
+ {
+ $name = $this->_prep_q_encoding($name);
+ }
}
$this->set_header('Reply-To', $name.' <'.$replyto.'>');
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 1ba85fa35..bd3d567d9 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -7,6 +7,10 @@ Version 3.0.5
Release Date: Not Released
+Bug fixes for 3.0.5
+-------------------
+
+- Fixed a bug (#4391) - :doc:`Email Library <libraries/email>` method ``reply_to()`` didn't apply Q-encoding.
Version 3.0.4
=============