Skip to content

Commit b2e4de0

Browse files
committed
Only use mb_strpos if multibyte support is requested
1 parent a80739f commit b2e4de0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/Sabberworm/CSS/Parser.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ private function consumeUntil($aEnd, $bIncludeEnd = false) {
540540
$aEnd = is_array($aEnd) ? $aEnd : array($aEnd);
541541
$iEndPos = null;
542542
foreach ($aEnd as $sEnd) {
543-
$iCurrentEndPos = mb_strpos($this->sText, $sEnd, $this->iCurrentPosition, $this->sCharset);
543+
$iCurrentEndPos = $this->strpos($this->sText, $sEnd, $this->iCurrentPosition, $this->sCharset);
544544
if($iCurrentEndPos === false) {
545545
continue;
546546
}
@@ -574,4 +574,12 @@ private function strlen($text) {
574574
}
575575
}
576576

577+
private function strpos($text, $needle, $offset, $charset) {
578+
if ($this->oParserSettings->bMultibyteSupport) {
579+
return mb_strpos($text, $needle, $offset, $charset);
580+
} else {
581+
return strpos($text, $needle, $offset);
582+
}
583+
}
584+
577585
}

0 commit comments

Comments
 (0)