Skip to content

Commit

Permalink
fix iconv notice thrown (mautic#13572)
Browse files Browse the repository at this point in the history
* fix iconv notice thrown

Signed-off-by: Jan Kozak <[email protected]>

* Rector fix

---------

Signed-off-by: Jan Kozak <[email protected]>
Co-authored-by: John Linhart <[email protected]>
Co-authored-by: John Linhart <[email protected]>
  • Loading branch information
3 people authored Apr 16, 2024
1 parent 446bc3c commit f7e90cf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/bundles/CoreBundle/Helper/InputHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,11 @@ public static function html($value)
// Special handling for HTML comments
$value = str_replace(['<!-->', '<!--', '-->'], ['<mcomment></mcomment>', '<mcomment>', '</mcomment>'], $value, $commentCount);

$hasUnicode = strlen($value) != strlen(iconv('UTF-8', 'Windows-1252', $value));
try {
$hasUnicode = strlen($value) != strlen(iconv('UTF-8', 'Windows-1252', $value));
} catch (\ErrorException) {
$hasUnicode = 'UTF-8"' === mb_detect_encoding($value);
}

$value = self::getFilter(true)->clean($value, $hasUnicode ? 'raw' : 'html');

Expand Down

0 comments on commit f7e90cf

Please sign in to comment.