[php-src] master: Add extra test for stale entity references

From: Date: Tue, 30 Apr 2024 20:56:07 +0000
Subject: [php-src] master: Add extra test for stale entity references
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-128282@lists.php.net to get a copy of this message
Author: Niels Dossche (nielsdos) Date: 2024-04-30T22:56:20+02:00 Commit: https://github.com/php/php-src/commit/fed1d5efb6bae3bc6b4c3df1738681bebe0adfee Raw diff: https://github.com/php/php-src/commit/fed1d5efb6bae3bc6b4c3df1738681bebe0adfee.diff Add extra test for stale entity references Changed paths: A ext/dom/tests/entity_reference_stale_03.phpt Diff: diff --git a/ext/dom/tests/entity_reference_stale_03.phpt b/ext/dom/tests/entity_reference_stale_03.phpt new file mode 100644 index 000000000000..dee005d8db99 --- /dev/null +++ b/ext/dom/tests/entity_reference_stale_03.phpt @@ -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) +}

« previous php.cvs (#128282) next »