Skip to content

Commit

Permalink
Merge pull request #205 from alecpl/fix-deps
Browse files Browse the repository at this point in the history
Drop ext-libxml requirement
  • Loading branch information
goetas authored Jan 11, 2023
2 parents 897eb51 + 24f49f4 commit 840783a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"require" : {
"ext-ctype": "*",
"ext-dom": "*",
"ext-libxml" : "*",
"php" : ">=5.3.0"
},
"require-dev": {
Expand Down
8 changes: 1 addition & 7 deletions src/HTML5/Parser/UTF8Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class UTF8Utils

/**
* Count the number of characters in a string.
* UTF-8 aware. This will try (in order) iconv, MB, libxml, and finally a custom counter.
* UTF-8 aware. This will try (in order) iconv, MB, and finally a custom counter.
*
* @param string $string
*
Expand All @@ -55,12 +55,6 @@ public static function countChars($string)
return iconv_strlen($string, 'utf-8');
}

if (function_exists('utf8_decode')) {
// MPB: Will this work? Won't certain decodes lead to two chars
// extrapolated out of 2-byte chars?
return strlen(utf8_decode($string));
}

$count = count_chars($string);

// 0x80 = 0x7F - 0 + 1 (one added to get inclusive range)
Expand Down

0 comments on commit 840783a

Please sign in to comment.