1--TEST-- 2Segfault when removing the Doctype node 3--SKIPIF-- 4<?php require_once('skipif.inc'); ?> 5--FILE-- 6<?php 7$xml = <<< XML 8<?xml version='1.0' encoding='utf-8' ?> 9<!DOCTYPE set PUBLIC "-//OASIS//DTD DocBook XML V5.0//EN" "http://www.docbook.org/xml/5.0/dtd/docbook.dtd" [ 10<!ENTITY foo '<foo>footext</foo>'> 11<!ENTITY bar '<bar>bartext</bar>'> 12]> 13<set>&foo;&bar;</set> 14XML; 15 16$doc = new DOMDocument(); 17$doc->loadXML($xml, LIBXML_NOENT); 18$n = $doc->doctype; 19$doc->removeChild($n); 20echo get_class($n), "\n"; 21print $doc->saveXML(); 22?> 23--EXPECT-- 24DOMDocumentType 25<?xml version="1.0" encoding="utf-8"?> 26<set><foo>footext</foo><bar>bartext</bar></set> 27