From 1466764d49233238c6097c95341875be552d7487 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Mon, 7 Sep 2015 15:07:27 +0200 Subject: [PATCH] Improved safety handling of bad PHP interpretor releases. --- reporting/includes/html_entity_decode_php4.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reporting/includes/html_entity_decode_php4.php b/reporting/includes/html_entity_decode_php4.php index 27d5f36b..b3ff4199 100644 --- a/reporting/includes/html_entity_decode_php4.php +++ b/reporting/includes/html_entity_decode_php4.php @@ -333,8 +333,9 @@ function html_entity_decode_php4($text_to_convert) { ); $return_text = strtr($text_to_convert, $htmlentities_table); - if (version_compare(PHP_VERSION, '5.3.0') >= 0) // 07.11.2014, from php 5.3.0 fixed deprecated preg_replace with the /e flag. Joe. - { + // 07.11.2014, from php 5.3.0 fixed deprecated preg_replace with the /e flag. Joe + if (version_compare(PHP_VERSION, '5.3.0') >= 0 && function_exists("preg_replace_callback")) + { $return_text = preg_replace_callback('~&#x([0-9a-f]+);~i', function ($m){ return chr(hexdec($m[1]));}, $return_text); $return_text = preg_replace_callback('~&#([0-9]+);~', function ($m){ return chr($m[1]);}, $return_text); } -- 2.30.2