comparator icon indicating copy to clipboard operation
comparator copied to clipboard

DOMNodeComparator swallows comments

Open theseer opened this issue 2 years ago • 3 comments

In DOMNodeComparator::nodeToText we call $node->C14n(); without any parameters.

That results in all Comment (<!-- ... -->) nodes to be stripped.

I'd consider that a bug.

Given we still have #87, and maybe #71, we should probably have a look into how this comparator works :)

theseer avatar Jul 27 '23 14:07 theseer

Additionally, the DOMNodeComparator::nodeToText has a bool parameter $canonicalize suggesting it could be optional. But the only caller, DOMNodeComparator::assertEquals, hardcodes it to true in both cases.

I guess we really need to refactor this one :)

theseer avatar Jul 27 '23 14:07 theseer

Maybe we can use some of PR #88 while doing so.

theseer avatar Jul 27 '23 14:07 theseer

@theseer https://github.com/sebastianbergmann/comparator/pull/97

WinterSilence avatar Mar 18 '24 15:03 WinterSilence