1--TEST--
2Importing an entity reference without also importing the document
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = Dom\XMLDocument::createFromString(<<<XML
9<?xml version="1.0" encoding="UTF-8"?>
10<!DOCTYPE root [
11    <!ENTITY foo "bar">
12]>
13<root>&foo;</root>
14XML);
15
16$importer = Dom\XMLDocument::createEmpty();
17$imported = $importer->importNode($dom->documentElement, true);
18echo $importer->saveXml($imported), "\n";
19
20var_dump($imported->firstChild);
21
22?>
23--EXPECT--
24<root>&foo;</root>
25object(Dom\EntityReference)#3 (14) {
26  ["nodeType"]=>
27  int(5)
28  ["nodeName"]=>
29  string(3) "foo"
30  ["baseURI"]=>
31  string(11) "about:blank"
32  ["isConnected"]=>
33  bool(false)
34  ["ownerDocument"]=>
35  string(22) "(object value omitted)"
36  ["parentNode"]=>
37  string(22) "(object value omitted)"
38  ["parentElement"]=>
39  string(22) "(object value omitted)"
40  ["childNodes"]=>
41  string(22) "(object value omitted)"
42  ["firstChild"]=>
43  NULL
44  ["lastChild"]=>
45  NULL
46  ["previousSibling"]=>
47  NULL
48  ["nextSibling"]=>
49  NULL
50  ["nodeValue"]=>
51  NULL
52  ["textContent"]=>
53  NULL
54}
55