From d61436256e8d0d296e9a83faa68d75d30b9e9fb3 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 25 Aug 2023 08:43:35 -0400 Subject: [PATCH] Replace PHP 8.2 deprecated mb_convert_encoding() call in Sanitizer --- wire/core/Sanitizer.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/wire/core/Sanitizer.php b/wire/core/Sanitizer.php index a0554af6..6c553c7c 100644 --- a/wire/core/Sanitizer.php +++ b/wire/core/Sanitizer.php @@ -1671,7 +1671,7 @@ class Sanitizer extends Wire { 'outCharset' => 'UTF-8', // output charset 'truncateTail' => true, // if truncate necessary for maxLength, remove chars from tail? False to truncate from head. 'trim' => true, // trim whitespace from beginning/end, or specify character(s) to trim, or false to disable - ); + ); static $alwaysReplace = null; $truncated = false; @@ -1682,13 +1682,9 @@ class Sanitizer extends Wire { if($options['maxBytes'] < 0) $options['maxBytes'] = 0; if($alwaysReplace === null) { - if($this->multibyteSupport) { - $alwaysReplace = array( - mb_convert_encoding('
', 'UTF-8', 'HTML-ENTITIES') => '', // line-seperator that is sometimes copy/pasted - ); - } else { - $alwaysReplace = array(); - } + $alwaysReplace = array( + html_entity_decode('
', ENT_QUOTES, 'UTF-8') => '', // line-seperator that is sometimes copy/pasted + ); } if($options['reduceSpace'] !== false && $options['stripSpace'] === false) {