1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Add extra test for stale entity references

This commit is contained in:
Niels Dossche
2024-04-30 22:56:20 +02:00
parent 6f989cdb75
commit fed1d5efb6

View File

@@ -0,0 +1,34 @@
--TEST--
Entity references with stale entity declaration 03
--EXTENSIONS--
dom
--FILE--
<?php
foreach (['firstChild', 'lastChild', 'textContent', 'childNodes'] as $prop) {
$dom = DOM\XMLDocument::createFromString(<<<XML
<!DOCTYPE foo [
<!ENTITY foo "bar">
]>
<foo>&foo;</foo>
XML);
$ref = $dom->documentElement->firstChild;
$decl = $ref->firstChild;
$nodes = $ref->childNodes;
$dom->removeChild($dom->doctype);
unset($decl);
var_dump($ref->$prop);
}
?>
--EXPECT--
NULL
NULL
NULL
object(DOM\NodeList)#1 (1) {
["length"]=>
int(0)
}