From 05aae4711cd9fa2c6288acc886e9e96ae963d323 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 9 Mar 2017 12:05:11 +0100 Subject: [PATCH] Replace xss_entity_decode_callback() method with lambda function --- program/lib/Roundcube/rcube_utils.php | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube/rcube_utils.php index 8f9a5cf50..07b60d30c 100644 --- a/program/lib/Roundcube/rcube_utils.php +++ b/program/lib/Roundcube/rcube_utils.php @@ -493,27 +493,16 @@ class rcube_utils */ public static function xss_entity_decode($content) { + $callback = function($matches) { return chr(hexdec($matches[1])); }; + $out = html_entity_decode(html_entity_decode($content)); $out = strip_tags($out); - $out = preg_replace_callback('/\\\([0-9a-f]{4})/i', - array(self, 'xss_entity_decode_callback'), $out); + $out = preg_replace_callback('/\\\([0-9a-f]{4})/i', $callback, $out); $out = preg_replace('#/\*.*\*/#Ums', '', $out); return $out; } - /** - * preg_replace_callback callback for xss_entity_decode - * - * @param array $matches Result from preg_replace_callback - * - * @return string Decoded entity - */ - public static function xss_entity_decode_callback($matches) - { - return chr(hexdec($matches[1])); - } - /** * Check if we can process not exceeding memory_limit *