This is an old post, but in case anyone is still looking at it, it seems the underlying issue was resolved beginning in PHP 7.4, when loadHTML() was upgraded to handle HTML5 tags. To work properly, this also requires libxml2 version 2.9.1 or later.