xref: /php-src/ext/dom/tests/bug55700.phpt (revision 7da2151f)
1--TEST--
2Bug #55700 (XPath namespace prefix conflict, global registerNodeNS flag)
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7$doc = new DOMDocument();
8$doc->loadXML('<prefix:root xmlns:prefix="urn:a" />');
9
10$xp = new DOMXPath($doc, true);
11$xp->registerNamespace('prefix', 'urn:b');
12
13echo($xp->query('//prefix:root')->length . "\n");
14
15$xp = new DOMXPath($doc, false);
16$xp->registerNamespace('prefix', 'urn:b');
17
18echo($xp->query('//prefix:root')->length . "\n");
19
20var_dump($xp->registerNodeNamespaces);
21$xp->registerNodeNamespaces = true;
22
23var_dump($xp->registerNodeNamespaces);
24
25echo($xp->query('//prefix:root')->length . "\n");
26
27var_dump($xp);
28?>
29--EXPECT--
301
310
32bool(false)
33bool(true)
341
35object(DOMXPath)#4 (2) {
36  ["document"]=>
37  string(22) "(object value omitted)"
38  ["registerNodeNamespaces"]=>
39  bool(true)
40}
41