incorrectly closing html comments
danslo opened this issue · 5 comments
See the following example:
<?php
require "vendor/autoload.php";
use PHPHtmlParser\Dom;
use PHPHtmlParser\Options;
$options = new Options();
$options->setCleanupInput(false);
$dom = new Dom();
$dom->setOptions($options);
$dom->loadStr('<!--<div><img />-->');
echo $dom->__toString();
No DOM manipulation was done, just loading string and immediately printing it.
Output is:
<!--<div--><img />-->
Expected output is:
<!--<div><img />-->
I assume this has to do with the change in 3.1.1:
Comment tags are now self-closing when cleanup input is set to false.
But that does not seem like proper behavior to me.
I have come across this as well. Can confirm that the bug appeared in 3.1.1. Also, this issue looks like a duplicate of #258.
confirm this bug still exists, seem to happen when a "/" is inside a comment.
Please see the mentioned commit for a fix. Also the package is now available with additional tweaks on packagist.
As this repo hasn't seen activity in a while, and there seems to be a fix in @EreMaijala 's repo, I'm closing this issue.