Skip to content

Commit

Permalink
Fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Mar 23, 2024
1 parent 456e1e9 commit d297dfe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions htdocs/core/lib/functions.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -7648,7 +7648,11 @@ function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes

// Warning: loadHTML does not support HTML5 on old libxml versions.
$dom = new DOMDocument('', 'UTF-8');
// If $stringtoclean is wrong, it will generates warnings. So we disable warnings and restore them later.
$savwarning = error_reporting();
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE);
$dom->loadHTML($stringtoclean, LIBXML_ERR_NONE | LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD | LIBXML_NONET | LIBXML_NOWARNING | LIBXML_NOXMLDECL);
error_reporting($savwarning);

if ($dom instanceof DOMDocument) {
for ($els = $dom->getElementsByTagname('*'), $i = $els->length - 1; $i >= 0; $i--) {
Expand Down

0 comments on commit d297dfe

Please sign in to comment.