From 3f426c498edc2571d8b29eb3514b976399062632 Mon Sep 17 00:00:00 2001 From: Simon Wisselink Date: Wed, 14 Sep 2022 13:19:53 +0200 Subject: [PATCH] Test for existence of htmlspecialchars flag (PHP < 5.4) --- libs/plugins/function.mailto.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/plugins/function.mailto.php b/libs/plugins/function.mailto.php index 5f4cf3a9..5119a153 100644 --- a/libs/plugins/function.mailto.php +++ b/libs/plugins/function.mailto.php @@ -101,8 +101,13 @@ function smarty_function_mailto($params) return; } - $string = '' . htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, Smarty::$_CHARSET) . ''; + $flags = ENT_QUOTES; + if (defined('ENT_SUBSTITUTE') && defined('ENT_HTML401')) { + $flags |= ENT_SUBSTITUTE | ENT_HTML401; + } + + $string = '' . htmlspecialchars($text, $flags, Smarty::$_CHARSET) . ''; if ($encode === 'javascript') { $js_encode = '';