1--TEST-- 2Delayed freeing element declaration 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7$doc = new DOMDocument; 8$doc->loadXML(<<<'XML' 9<?xml version="1.0"?> 10<!DOCTYPE books [ 11<!ELEMENT parent (child1, child2)> 12<!ELEMENT child1 (#PCDATA)> 13<!ELEMENT child2 (#PCDATA)> 14]> 15<container><parent/></container> 16XML, LIBXML_NOENT); 17$element = $doc->documentElement->firstElementChild; 18echo $doc->saveXML(), "\n"; 19var_dump($element->tagName); 20var_dump($element->textContent); 21 22$doc->removeChild($doc->doctype); 23echo $doc->saveXML(), "\n"; 24var_dump($element->tagName); 25var_dump($element->textContent); 26?> 27--EXPECT-- 28<?xml version="1.0"?> 29<!DOCTYPE books [ 30<!ELEMENT parent (child1 , child2)> 31<!ELEMENT child1 (#PCDATA)> 32<!ELEMENT child2 (#PCDATA)> 33]> 34<container><parent/></container> 35 36string(6) "parent" 37string(0) "" 38<?xml version="1.0"?> 39<container><parent/></container> 40 41string(6) "parent" 42string(0) "" 43