1--TEST--
2Delayed freeing document fragment
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7$doc = new DOMDocument;
8$frag = $doc->createDocumentFragment();
9$frag->appendChild($doc->createElementNS('some:ns', 'child', 'text content'));
10$child = $doc->appendChild($doc->createElement('root'))->appendChild($frag);
11var_dump($doc->textContent);
12$doc->documentElement->remove();
13var_dump($doc->textContent);
14unset($doc);
15var_dump($child->textContent);
16
17$doc = new DOMDocument;
18$doc->appendChild($doc->createElement('container'));
19$doc->documentElement->appendChild($doc->importNode($frag));
20unset($frag);
21var_dump($doc->textContent);
22
23var_dump($child->parentNode);
24?>
25--EXPECTF--
26string(12) "text content"
27string(0) ""
28string(12) "text content"
29
30Warning: DOMNode::appendChild(): Document Fragment is empty in %s on line %d
31string(0) ""
32NULL
33