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