-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed DOMNode comparator for canonical comparison #1236
Conversation
I wasn't sure about 7dadedf either, @sebastianbergmann. Maybe it makes sense to look at the |
I agree with @whatthejeff that the The problem I wanted to fix with 7dadedf was that the comparison could detect an inequality but then the diff would show no differences. |
I decided to keep the change as small as possible. Actually it makes sense for the method signature but from an XML point of view, it's problematic. $canonicalize defaults to Also a key point is the backwards compatibility. Up to 4.0.17, the default behavior for the DOMNode Comparator was $canonical=true. But to keep up with the interface, the default behavior is $canonical=false. And at least the docblock only mentions arrays. So even if we would adjust every assertion method that results in DOMNode::assertEquals, we would brake other projects that depend on that. I think there are 2 ways to see a fix that uses the $canonical correctly: either it's a bugfix that the $canonical was ignored before (like someone had opened an issue "$canonical argument is ignored") or it introduces new behavior when used the "old" way (BC break).
Can you give an example for that? Canonicalization of equal xml should keep it equal... |
Can you please have a look at 5934d89? |
Maybe you could add the unittests. Then we would know if it produces the same result. |
Yes, I will add the unit tests to the Comparator component. |
Well, you could have copied my test and execute it. Thats what I would have done to "have a look at [that commit]" |
This test was suggested in sebastianbergmann/phpunit#1236 (comment), but wasn't be implemented.
This test was suggested in sebastianbergmann/phpunit#1236 (comment), but wasn't be implemented.
This test was suggested in sebastianbergmann/phpunit#1236 (comment), but wasn't be implemented.
7dadedf introduced with Release 4.0.18 a bug when comparing two DOMNodes.
Previously, the comparison was always canonical (thanks to C14N), but now it no longer is. I would call that a BC break. This PR is basically a revert of that commit to make the DOMNode comparator canonical again. The test should make the problem pretty clear:
Realworld example: paratestphp/paratest#90