caxy/php-htmldiff

Warning DOMDocument::loadHTML(): Unexpected end tag : strong

sindivinch opened this issue · 3 comments

$str1 = '<ul>
<li>li 1</li>
<li><strong>li 2</strong></li>
</ul>';
        $str2 = '<ul>
<li>li 1</li>
<li><strong>li 2</strong></li>
<li>li 4</li>
</ul>';
        $htmlDiff = new HtmlDiff($str1, $str2);
        $str = $htmlDiff->build();
        echo $str;

Code above raises warning DOMDocument::loadHTML(): Unexpected end tag : strong in caxy/php-htmldiff/lib/Caxy/HtmlDiff/ListDiffLines.php at line 409

Same!

DOMDocument::loadHTML(): Unexpected end tag : strong (...)

I looked into this and found out that special-case-tags can cripple the HTML, resulting in this error.

Spend a couple of hours trying to repair the feature, until I realized it's something we adopted from the library this library is based on, and then decided to remove the feature in its entirety since it seems to not really serve any purpose, and even break html output in some cases.

See this PR: #108