microformats / php-mf2

php-mf2 is a pure, generic microformats-2 parser for PHP. It makes HTML as easy to consume as JSON.
Creative Commons Zero v1.0 Universal
194 stars 38 forks source link

mb_convert_encoding() throws error in PHP 8.1 #251

Open lazaruscorporation opened 1 year ago

lazaruscorporation commented 1 year ago

I'm getting the following error from the parser (running on PHP 8.1):

CRITICAL - 2023-10-13 13:56:58 --> mb_convert_encoding(): Argument #3 ($from_encoding) must specify at least one encoding
  in VENDORPATH/mf2/mf2/Mf2/Parser.php on line 96.
  1 VENDORPATH/mf2/mf2/Mf2/Parser.php(96): mb_convert_encoding()
  2 VENDORPATH/mf2/mf2/Mf2/Parser.php(365): Mf2\unicodeToHtmlEntities()
  3 VENDORPATH/indieweb/mention-client/src/IndieWeb/MentionClient.php(156): Mf2\Parser->__construct()
  ...

Looking at the comments on https://www.php.net/manual/en/function.mb-detect-encoding.php it seems like there have been some changes in the way mb_detect_encoding() works in PHP 8.1 - I'm not sure if this is the cause of the error I'm getting?

gRegorLove commented 1 year ago

Maybe related: #221