Hello,
The warning
everity: Warning --> DOMDocument::loadHTML(): Tag close invalid in Entity
is from PHP DOM, loadHTML function, and it appears when some not standard tag is added (as phpdocx uses to transform HTML such as the close tag) and the error level you are using is displaying all PHP warnings and PHP messages or you are using xdebug or the scream extension (https://pecl.php.net/package/scream), even @ is added to supress them.
phpdocx uses @ in the code when calling loadHTML from PHP DOM to remove that warning:
@$this->_xml->loadHTML($str);
This line (with @) hides the warning in all PHP versions (from PHP 5 to PHP 8.1), unless the error level you are using disables it. PHP 8 was updated to disable @ when a Fatal error is thrown, not warnings or notices (https://php.watch/versions/8.0/fatal-error-suppression).
If you are using a custom error level that shows all PHP messages, even those suppressed by @ as phpdocx includes, you can hide that specific warning adding:
libxml_use_internal_errors(true);
before transforming the HTML, for example:
libxml_use_internal_errors(true);
$docx->embedHTML($html);
About the notices, all versions of phpdocx applies the following error level when importing HTML:
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
show notices shouldn't appear unless your code is overwritting this default error level or or you are using xdebug. Added @ should hide the notices in all PHP versions (including PHP 7.4, PHP 8 and PHP 8.1). We have tested it with: PHP 5.2, PHP 5.6, PHP 7, PHP 7.3, PHP 7.4, PHP 8 and PHP 8.1 and no warnings or notices appear with the default PHP settings.
Today, phpdocx 12.5.1 has been launched (https://www.phpdocx.com/news/post/phpdocx-v12-5-release-notes/224) with three minor updates. This new version calls libxml_use_internal_errors internally before loadHTML to hide that warning automatically when using PHP settings that @ doesn't run as expected with PHP DOM loadHTML.
Please do some test using phpdocx standalone using PHP CLI mode, and check if you get the same notices with the default code and default error reporting settings.
Also please send to contact[at]phpdocx.com or post the error reporting level you are using and if you are using xdebug, and a smalll HTML you are transforming that shows the notices so we can test it using the same setup you are using.
Regards.