1--TEST--
2Delayed freeing namespace xmlns declaration - attribute variation
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7$doc = new DOMDocument;
8$doc->loadXML('<?xml version="1.0"?><container xmlns="http://php.net"/>');
9$doc->documentElement->appendChild($doc->createElementNS('http://php.net', 'example'));
10echo $doc->saveXML(), "\n";
11
12$declaration = $doc->documentElement->getAttributeNode('xmlns');
13var_dump($declaration->nodeValue);
14
15$doc->documentElement->remove();
16echo $doc->saveXML(), "\n";
17
18var_dump($declaration->nodeValue);
19unset($doc);
20var_dump($declaration->parentNode->nodeName);
21var_dump($declaration->parentNode->childNodes[0]->nodeName);
22
23$declaration->parentNode->childNodes[0]->remove();
24var_dump($declaration->parentNode->nodeName);
25var_dump($declaration->parentNode->childNodes[0]);
26?>
27--EXPECT--
28<?xml version="1.0"?>
29<container xmlns="http://php.net"><example/></container>
30
31string(14) "http://php.net"
32<?xml version="1.0"?>
33
34string(14) "http://php.net"
35string(9) "container"
36string(7) "example"
37string(9) "container"
38NULL
39