Fix dol_escape_htmltag to prevent bad strip of char (#29931)

Co-authored-by: Hystepik <lmarcouiller@nltechno.com>
This commit is contained in:
Lucas Marcouiller
2024-06-08 14:51:32 +02:00
committed by GitHub
parent 61c9245498
commit d63687da6d
2 changed files with 17 additions and 9 deletions

View File

@@ -1119,6 +1119,10 @@ class FunctionsLibTest extends CommonClassTest
$input = 'x&<b>#</b>,"'; // & and " are converted into html entities, <b> are not removed
$result = dol_escape_htmltag($input, 1);
$this->assertEquals('x&amp;&lt;b&gt;#&lt;/b&gt;,&quot;', $result);
$input = '<img alt="" src="https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png">'; // & and " are converted into html entities, <b> are not removed
$result = dol_escape_htmltag($input, 1, 1, 'common', 0, 1);
$this->assertEquals('<img alt="" src="https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png">', $result);
}