xref: /php-src/ext/dom/tests/gh13012_ns.phpt (revision 93951cf5)
1--TEST--
2GH-13012 (DOMNode::isEqualNode() is incorrect when attribute order is different - ns variation)
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = new DOMDocument;
9$dom->loadXML("<root><x/><x xmlns:a=\"urn:a\" xmlns:b=\"urn:b\"/><x xmlns:b=\"urn:b\" xmlns:a=\"urn:a\"/></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/> with <x/>
21bool(true)
22Comparing <x/> with <x xmlns:a="urn:a" xmlns:b="urn:b"/>
23bool(false)
24Comparing <x/> with <x xmlns:b="urn:b" xmlns:a="urn:a"/>
25bool(false)
26Comparing <x xmlns:a="urn:a" xmlns:b="urn:b"/> with <x/>
27bool(false)
28Comparing <x xmlns:a="urn:a" xmlns:b="urn:b"/> with <x xmlns:a="urn:a" xmlns:b="urn:b"/>
29bool(true)
30Comparing <x xmlns:a="urn:a" xmlns:b="urn:b"/> with <x xmlns:b="urn:b" xmlns:a="urn:a"/>
31bool(true)
32Comparing <x xmlns:b="urn:b" xmlns:a="urn:a"/> with <x/>
33bool(false)
34Comparing <x xmlns:b="urn:b" xmlns:a="urn:a"/> with <x xmlns:a="urn:a" xmlns:b="urn:b"/>
35bool(true)
36Comparing <x xmlns:b="urn:b" xmlns:a="urn:a"/> with <x xmlns:b="urn:b" xmlns:a="urn:a"/>
37bool(true)
38