forked from Wavyzz/dolibarr
Fix infinite loop
This commit is contained in:
@@ -6636,13 +6636,17 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
|
|||||||
} else {
|
} else {
|
||||||
// Remove '<' into remainging, so remove non closing html tags like '<abc' or '<<abc'. Note: '<123abc' is not a html tag (can be kept), but '<abc123' is (must be removed).
|
// Remove '<' into remainging, so remove non closing html tags like '<abc' or '<<abc'. Note: '<123abc' is not a html tag (can be kept), but '<abc123' is (must be removed).
|
||||||
$pattern = "/<[^<>]+>/";
|
$pattern = "/<[^<>]+>/";
|
||||||
|
// Example of $temp: <a href="/myurl" title="<u>A title</u>">0000-021</a>
|
||||||
|
// pass 1 - $temp after pass 1: <a href="/myurl" title="A title">0000-021
|
||||||
|
// pass 2 - $temp after pass 2: 0000-021
|
||||||
|
$tempbis = $temp;
|
||||||
do {
|
do {
|
||||||
// Example of $temp: <a href="/myurl" title="<u>A title</u>">0000-021</a>
|
$temp = $tempbis;
|
||||||
// pass 1 - $temp after pass 1: <a href="/myurl" title="A title">0000-021
|
|
||||||
// pass 2 - $temp after pass 2: 0000-021
|
|
||||||
$tempbis = str_replace('<>', '', $temp); // No reason to have this into a text, except if value is to try bypass the next html cleaning
|
$tempbis = str_replace('<>', '', $temp); // No reason to have this into a text, except if value is to try bypass the next html cleaning
|
||||||
$tempbis = preg_replace($pattern, '', $tempbis);
|
$tempbis = preg_replace($pattern, '', $tempbis);
|
||||||
|
//$idowhile++; print $temp.'-'.$tempbis."\n"; if ($idowhile > 100) break;
|
||||||
} while ($tempbis != $temp);
|
} while ($tempbis != $temp);
|
||||||
|
|
||||||
$temp = $tempbis;
|
$temp = $tempbis;
|
||||||
|
|
||||||
// Remove '<' into remaining, so remove non closing html tags like '<abc' or '<<abc'. Note: '<123abc' is not a html tag (can be kept), but '<abc123' is (must be removed).
|
// Remove '<' into remaining, so remove non closing html tags like '<abc' or '<<abc'. Note: '<123abc' is not a html tag (can be kept), but '<abc123' is (must be removed).
|
||||||
|
|||||||
Reference in New Issue
Block a user