xref: /php-src/ext/dom/tests/gh13012.phpt (revision 93951cf5)
1--TEST--
2GH-13012 (DOMNode::isEqualNode() is incorrect when attribute order is different)
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = new DOMDocument;
9$dom->loadXML("<root><x a='a' b='b'/><x b='b' a='a'/><x b='b' a='a' c='c'/></root>");
10
11foreach ($dom->getElementsByTagName('x') as $x1) {
12    foreach ($dom->getElementsByTagName('x') as $x2) {
13        echo "Comparing ", $dom->saveXML($x1), " with ", $dom->saveXML($x2), "\n";
14        var_dump($x1->isEqualNode($x2));
15    }
16}
17
18?>
19--EXPECT--
20Comparing <x a="a" b="b"/> with <x a="a" b="b"/>
21bool(true)
22Comparing <x a="a" b="b"/> with <x b="b" a="a"/>
23bool(true)
24Comparing <x a="a" b="b"/> with <x b="b" a="a" c="c"/>
25bool(false)
26Comparing <x b="b" a="a"/> with <x a="a" b="b"/>
27bool(true)
28Comparing <x b="b" a="a"/> with <x b="b" a="a"/>
29bool(true)
30Comparing <x b="b" a="a"/> with <x b="b" a="a" c="c"/>
31bool(false)
32Comparing <x b="b" a="a" c="c"/> with <x a="a" b="b"/>
33bool(false)
34Comparing <x b="b" a="a" c="c"/> with <x b="b" a="a"/>
35bool(false)
36Comparing <x b="b" a="a" c="c"/> with <x b="b" a="a" c="c"/>
37bool(true)
38