From 5329a55bfd2b00d617a40d587cd37050d964ccbf Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 12 Dec 2020 18:57:48 +0000 Subject: Mark the relevant php8 tests as broken (#359) * Skip tests broken on php8 * Oops * Fix some tests * Add some XXE tests for php8 * Fix a test --- src/tests/xxe/disable_xxe_dom_disabled_php8.phpt | 60 ++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/tests/xxe/disable_xxe_dom_disabled_php8.phpt (limited to 'src/tests/xxe/disable_xxe_dom_disabled_php8.phpt') diff --git a/src/tests/xxe/disable_xxe_dom_disabled_php8.phpt b/src/tests/xxe/disable_xxe_dom_disabled_php8.phpt new file mode 100644 index 0000000..c0db7fc --- /dev/null +++ b/src/tests/xxe/disable_xxe_dom_disabled_php8.phpt @@ -0,0 +1,60 @@ +--TEST-- +Disable XXE in php8 +--SKIPIF-- + + +--INI-- +sp.configuration_file={PWD}/config/disable_xxe_disable.ini +--EXTENSIONS-- +dom +--FILE-- +WARNING, external entity loaded!'; +file_put_contents($dir . '/content.txt', $content); + +$xml = << + +]> +&foo; +EOD; + +file_put_contents($dir . '/content.xml', $xml); + +libxml_disable_entity_loader(true); +$dom = new DOMDocument('1.0'); +$dom->loadXML($xml, LIBXML_DTDATTR|LIBXML_DTDLOAD|LIBXML_NOENT); +printf("libxml_disable_entity to true: %s\n", $dom->getElementsByTagName('testing')->item(0)->nodeValue); + +libxml_disable_entity_loader(false); +$dom = new DOMDocument('1.0'); +$dom->loadXML($xml, LIBXML_DTDATTR|LIBXML_DTDLOAD|LIBXML_NOENT); +printf("libxml_disable_entity to false: %s\n", $dom->getElementsByTagName('testing')->item(0)->nodeValue); + +$xml = "foo"; +file_put_contents('content.xml', $xml); + +libxml_disable_entity_loader(false); +$dom = new DOMDocument('1.0'); +$dom->loadXML($xml, LIBXML_DTDATTR|LIBXML_DTDLOAD|LIBXML_NOENT); +printf("without xxe: %s", $dom->getElementsByTagName('testing')->item(0)->nodeValue); + +?> +--CLEAN-- + +--EXPECTF-- +Deprecated: Function libxml_disable_entity_loader() is deprecated in %s/tests/xxe/disable_xxe_dom_disabled.php on line %d +libxml_disable_entity to true: WARNING, external entity loaded! + +Deprecated: Function libxml_disable_entity_loader() is deprecated in %s/tests/xxe/disable_xxe_dom_disabled.php on line %d +libxml_disable_entity to false: WARNING, external entity loaded! + +Deprecated: Function libxml_disable_entity_loader() is deprecated in %s/tests/xxe/disable_xxe_dom_disabled.php on line %d + -- cgit v1.3