Masterminds / html5-php

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

Error in php 8.1 #225

Open mikeborisov78 opened 1 year ago

mikeborisov78 commented 1 year ago

src/HTML5/Parser/UTF8Utils.php

$data = mb_convert_encoding($data, 'UTF-8', $encoding);

error if $data is null in PHP 8.1 help this:

$data = mb_convert_encoding($data.'', 'UTF-8', $encoding);

stof commented 1 year ago

The phpdoc on the method declares the contract as @param string $data. So you should only pass a string.

Btw, this won't trigger an error on PHP 8.1 but only a deprecation warning.