1--TEST--
2Entity references with stale entity declaration 01
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = new DOMDocument;
9$dom->loadXML(<<<XML
10<!DOCTYPE foo [
11<!ENTITY foo "bar">
12]>
13<foo>&foo;</foo>
14XML);
15
16$ref = $dom->documentElement->firstChild;
17$decl = $ref->firstChild;
18
19$nodes = $ref->childNodes;
20$dom->removeChild($dom->doctype);
21unset($decl);
22
23var_dump($nodes);
24var_dump($ref->firstChild);
25var_dump($ref->lastChild);
26var_dump($ref->textContent);
27var_dump($ref->childNodes);
28
29?>
30--EXPECT--
31object(DOMNodeList)#4 (1) {
32  ["length"]=>
33  int(0)
34}
35NULL
36NULL
37string(0) ""
38object(DOMNodeList)#2 (1) {
39  ["length"]=>
40  int(0)
41}
42