From 854d17b46bd379beefa005e470357122e56e32eb Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 5 Jun 2014 08:52:08 +0000 Subject: [PATCH] fix PHP Deprecated: preg_replace(): The /e modifier is deprecated --- phpgwapi/inc/class.phpmailer.inc.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/phpgwapi/inc/class.phpmailer.inc.php b/phpgwapi/inc/class.phpmailer.inc.php index a9ef694b09..d99a0a41c2 100644 --- a/phpgwapi/inc/class.phpmailer.inc.php +++ b/phpgwapi/inc/class.phpmailer.inc.php @@ -1875,16 +1875,23 @@ 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!*+\/ -])/", function($matches) + { + return '='.sprintf('%02X', ord($matches[1])); + }, $encoded); break; case 'comment': - $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); + $encoded = preg_replace_callback("/([\(\)\"])/", function($matches) + { + return '='.sprintf('%02X', ord($matches[1])); + }, $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])/', function($matches) + { + return '='.sprintf('%02X', ord($matches[1])); + }, $encoded); break; }