From 5f5304a60453fc11865e4c5b548ef9a438a09720 Mon Sep 17 00:00:00 2001 From: Thomas Weinert Date: Tue, 26 Oct 2021 15:41:17 +0200 Subject: [PATCH] [FIX] Do Not Remove '0' As RTE Element Content --- src/system/papaya_strings.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/system/papaya_strings.php b/src/system/papaya_strings.php index 47f9aafb4..7149f2f2e 100644 --- a/src/system/papaya_strings.php +++ b/src/system/papaya_strings.php @@ -133,15 +133,15 @@ public static function escapeHTMLTags($str, $nl2br = FALSE) { switch ($itemChar) { case '<' : //tag or comment starts $tagsAmount++; - if (!empty($buffer)) { + if ($buffer !== '') { if ($nl2br) { - $result .= preg_replace("((?:\r\n)|(?:\n\r)|[\r\n])", "
\n", $buffer); + $result .= preg_replace("(\r\n|\n\r|[\r\n])", "
\n", $buffer); } else { $result .= $buffer; } } $buffer = ''; - if (substr($str, $nextItemPos, 4) == ''; } $buffer = ''; @@ -178,11 +178,11 @@ public static function escapeHTMLTags($str, $nl2br = FALSE) { } } while (FALSE !== $nextItemPos); $buffer .= substr($str, $offset); - if ((!empty($buffer)) && $status == 0) { + if ($buffer !== '' && $status === 0) { $result .= $buffer; } - if ($tagsAmount == 0 && $nl2br == TRUE) { - $result = preg_replace("((?:\r\n)|(?:\n\r)|[\r\n])", "
\n", $buffer); + if ($tagsAmount === 0 && $nl2br === TRUE) { + $result = preg_replace("(\r\n|\n\r|[\r\n])", "
\n", $buffer); } return $result; } @@ -800,4 +800,3 @@ public static function fgetcsv( return $ret; } } -