xref: /PHP-8.2/ext/dom/tests/bug54382.phpt (revision bd9f4fa6)
1--TEST--
2Bug #54382 DOMNode::getAttributeNodeNS doesn't get xmlns* attributes
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7$xmlString = '<?xml version="1.0" encoding="utf-8" ?>
8<root xmlns="http://ns" xmlns:ns2="http://ns2">
9    <ns2:child />
10</root>';
11
12$xml=new DOMDocument();
13$xml->loadXML($xmlString);
14$de = $xml->documentElement;
15
16$ns2 = $de->getAttributeNodeNS("http://www.w3.org/2000/xmlns/", "ns2");
17if ($ns2 == NULL) {
18  echo 'namespace node does not exist.' . "\n";
19} else {
20  echo 'namespace node prefix=' . $ns2->prefix . "\n";
21  echo 'namespace node namespaceURI=' . $ns2->namespaceURI . "\n";
22}
23?>
24--EXPECT--
25namespace node prefix=ns2
26namespace node namespaceURI=http://ns2
27