From 66eabe87170ee3098b29ec702de33dca4388129e Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 24 Aug 2017 13:54:58 +0800 Subject: [PATCH] * fix for mail no subject. --- lib/phpmailer/phpmailer.class.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/phpmailer/phpmailer.class.php b/lib/phpmailer/phpmailer.class.php index 7902a07c8a..19613f3828 100644 --- a/lib/phpmailer/phpmailer.class.php +++ b/lib/phpmailer/phpmailer.class.php @@ -1724,16 +1724,16 @@ class PHPMailer { switch (strtolower($position)) { case 'phrase': - $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); + $encoded = preg_replace_callback("/([^A-Za-z0-9!*+\/ -])/", array(&$this, 'ordChar'), $encoded); break; case 'comment': - $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); + $encoded = preg_replace_callback("/([\(\)\"])/", array(&$this, 'ordChar'), $encoded); case 'text': default: // Replace every high ascii, control =, ? and _ characters //TODO using /e (equivalent to eval()) is probably not a good idea - $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e', - "'='.sprintf('%02X', ord('\\1'))", $encoded); + $encoded = preg_replace_callback('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/', + array(&$this, 'ordChar'), $encoded); break; } @@ -2309,6 +2309,11 @@ class PHPMailer { call_user_func_array($this->action_function,$params); } } + + public function ordChar($match) + { + return '=' . sprintf('%02X', ord($match[1])); + } } class phpmailerException extends Exception {