1--TEST--
2Entity references with stale entity declaration 03
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8foreach (['firstChild', 'lastChild', 'textContent', 'childNodes'] as $prop) {
9    $dom = Dom\XMLDocument::createFromString(<<<XML
10    <!DOCTYPE foo [
11    <!ENTITY foo "bar">
12    ]>
13    <foo>&foo;</foo>
14    XML);
15
16    $ref = $dom->documentElement->firstChild;
17    $decl = $ref->firstChild;
18
19    $nodes = $ref->childNodes;
20    $dom->removeChild($dom->doctype);
21    unset($decl);
22
23    var_dump($ref->$prop);
24}
25
26?>
27--EXPECT--
28NULL
29NULL
30NULL
31object(Dom\NodeList)#1 (1) {
32  ["length"]=>
33  int(0)
34}
35