1--TEST--
2Cloning an entity reference without also cloning 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$clone = $dom->documentElement->cloneNode(true);
17echo $dom->saveXml($clone), "\n";
18
19var_dump($clone->firstChild->firstChild);
20
21?>
22--EXPECTF--
23<root>&foo;</root>
24object(Dom\Entity)#4 (17) {
25  ["publicId"]=>
26  NULL
27  ["systemId"]=>
28  NULL
29  ["notationName"]=>
30  NULL
31  ["nodeType"]=>
32  int(17)
33  ["nodeName"]=>
34  string(3) "foo"
35  ["baseURI"]=>
36  string(%d) "%s"
37  ["isConnected"]=>
38  bool(true)
39  ["ownerDocument"]=>
40  string(22) "(object value omitted)"
41  ["parentNode"]=>
42  string(22) "(object value omitted)"
43  ["parentElement"]=>
44  NULL
45  ["childNodes"]=>
46  string(22) "(object value omitted)"
47  ["firstChild"]=>
48  string(22) "(object value omitted)"
49  ["lastChild"]=>
50  string(22) "(object value omitted)"
51  ["previousSibling"]=>
52  NULL
53  ["nextSibling"]=>
54  NULL
55  ["nodeValue"]=>
56  NULL
57  ["textContent"]=>
58  NULL
59}
60