xref: /PHP-8.0/ext/dom/tests/bug55700.phpt (revision 6c963694)
1--TEST--
2Bug #55700 (XPath namespace prefix conflict, global registerNodeNS flag)
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
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