Masterminds / html5-php

An HTML5 parser and serializer for PHP.
http://masterminds.github.io/html5-php/
Other
1.55k stars 114 forks source link

Drupal Feeds throw error related to UTF8Utils.php encoding function #228

Open ChrisB55 opened 1 year ago

ChrisB55 commented 1 year ago

Drupal 9 website Drupal core 9.4.11 Web Server nginx/1.20.1. PHP Version 8.0.27 site composer.lock file references "masterminds/html5": "^2.7". The relevant modules are the feeds module and the feeds tamper module.

When attempting to restore txt file assets via the feeds module an error is thrown preventing any of the import file from running. The error will not occur if the .txt has no special characters or encoding. If \22238, or <93>brackets, etc are present the feed will fail and throw an error point to mb_convert_encoding. Around 10%-20% of the assets files in my import won't run and there is no message pointing to which records have the problems until you check individually.

Previously the feeds handled this code correctly, but at some point it stopped possibly related to php 8 or server changes.

Error Message

Message | ValueError: mb_convert_encoding(): Argument #3 ($from_encoding) must specify at least one encoding in mb_convert_encoding() (line 109 of /data/site/vendor/masterminds/html5/src/HTML5/Parser/UTF8Utils.php)#0 /data/site /vendor/masterminds/html5/src/HTML5/Parser/UTF8Utils.php(109): mb_convert_encoding()

Line 109 UTF8Utils.php ( I think it's line 103 in the github repo) $data = mb_convert_encoding($data, 'UTF-8', $encoding);