From e03fbda96a2a9601bc6433d24d2238c356f45063 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Mar 2021 14:50:44 +0200 Subject: [PATCH] Avoid to obfuscate attributes with html tags inside --- htdocs/core/lib/functions.lib.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d9c0685b96b..2b85004d862 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -775,13 +775,15 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options = } break; case 'restricthtml': // Recommended for most html textarea - $out = dol_string_onlythesehtmltags($out, 0, 1, 1); - - // We should also exclude non expected attributes - if (!empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)) { - $out = dol_string_onlythesehtmlattributes($out); - } + do { + $oldstringtoclean = $out; + $out = dol_string_onlythesehtmltags($out, 0, 1, 1); + // We should also exclude non expected attributes + if (!empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)) { + $out = dol_string_onlythesehtmlattributes($out); + } + } while ($oldstringtoclean != $out); break; case 'custom': if (empty($filter)) {