fix PHP 8.0 ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)

This commit is contained in:
Ralf Becker 2021-11-05 11:38:49 +01:00
parent 7ac13da96f
commit 57ac760a78

View File

@ -564,7 +564,11 @@ class Html
{ {
// avoid infinit loop in case the endof pre can't be found, just give the // avoid infinit loop in case the endof pre can't be found, just give the
// end position to return the rest of content as return html // end position to return the rest of content as return html
$endofpre = (stripos($html,'</pre>',$pos) === false ? strlen($html) : stripos($html,'</pre>',$pos)); if (($endofpre = stripos($html, '</pre>', $pos)) === false)
{
$html2ret[] = substr($html, $pos);
break;
}
$length = $endofpre-$pos+6; $length = $endofpre-$pos+6;
$html2ret[] = substr($html,$pos,$length); $html2ret[] = substr($html,$pos,$length);
$searchFor = '<pre '; $searchFor = '<pre ';