summaryrefslogtreecommitdiff
path: root/src/tests/xxe/disable_xxe_dom.phpt
diff options
context:
space:
mode:
authorJulien Voisin2020-12-24 10:32:28 +0000
committerGitHub2020-12-24 10:32:28 +0000
commit98ed3be52fa15521ef405fc8029176279d80778e (patch)
treebafe6541bb3d3863f7edb9196a3e1db40c88bf7f /src/tests/xxe/disable_xxe_dom.phpt
parenta9e240ef0655175f930810cf78ac7df593a6dde6 (diff)
Add PHP8 support
Diffstat (limited to 'src/tests/xxe/disable_xxe_dom.phpt')
-rw-r--r--src/tests/xxe/disable_xxe_dom.phpt75
1 files changed, 0 insertions, 75 deletions
diff --git a/src/tests/xxe/disable_xxe_dom.phpt b/src/tests/xxe/disable_xxe_dom.phpt
deleted file mode 100644
index 99ed572..0000000
--- a/src/tests/xxe/disable_xxe_dom.phpt
+++ /dev/null
@@ -1,75 +0,0 @@
1--TEST--
2Disable XXE, in php8
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus") || !extension_loaded("dom")) print("skip"); ?>
5<?php if (PHP_VERSION_ID < 80000) print "skip"; ?>
6--INI--
7sp.configuration_file={PWD}/config/disable_xxe.ini
8--EXTENSIONS--
9dom
10--FILE--
11<?php
12$dir = __DIR__;
13$content = 'WARNING, external entity loaded!';
14file_put_contents('content.txt', $content);
15
16$xml = <<<EOD
17<?xml version="1.0"?>
18<!DOCTYPE root
19[
20<!ENTITY foo SYSTEM "file://$dir/content.txt">
21]>
22<test><testing>&foo;</testing></test>
23EOD;
24
25file_put_contents('content.xml', $xml);
26
27libxml_disable_entity_loader(true);
28$dom = new DOMDocument('1.0');
29$dom->loadXML($xml, LIBXML_DTDATTR|LIBXML_DTDLOAD|LIBXML_NOENT);
30printf("libxml_disable_entity to true: %s\n", $dom->getElementsByTagName('testing')->item(0)->nodeValue);
31
32libxml_disable_entity_loader(false);
33$dom = new DOMDocument('1.0');
34$dom->loadXML($xml, LIBXML_DTDATTR|LIBXML_DTDLOAD|LIBXML_NOENT);
35printf("libxml_disable_entity to false: %s\n", $dom->getElementsByTagName('testing')->item(0)->nodeValue);
36
37$xml = "<test><testing>foo</testing></test>";
38file_put_contents('content.xml', $xml);
39
40libxml_disable_entity_loader(false);
41$dom = new DOMDocument('1.0');
42$dom->loadXML($xml, LIBXML_DTDATTR|LIBXML_DTDLOAD|LIBXML_NOENT);
43printf("without xxe: %s", $dom->getElementsByTagName('testing')->item(0)->nodeValue);
44
45?>
46--CLEAN--
47<?php
48$dir = __DIR__;
49unlink($dir . "content.xml");
50unlink($dir . "content.txt");
51?>
52--EXPECTF--
53Deprecated: Function libxml_disable_entity_loader() is deprecated in %s/tests/xxe/disable_xxe_dom.php on line %d
54
55Warning: DOMDocument::loadXML(): I/O warning : failed to load external entity "file://%s/tests/xxe/content.txt" in /var/www/html/snuffleupagus/src/tests/xxe/disable_xxe_dom.php on line %d
56
57Warning: DOMDocument::loadXML(): Failure to process entity foo in Entity, line: 6 in %s/tests/xxe/disable_xxe_dom.php on line %d
58
59Warning: DOMDocument::loadXML(): Entity 'foo' not defined in Entity, line: 6 in %s/tests/xxe/disable_xxe_dom.php on line %d
60
61Warning: Attempt to read property "nodeValue" on null in %s/tests/xxe/disable_xxe_dom.php on line %d
62libxml_disable_entity to true:
63
64Deprecated: Function libxml_disable_entity_loader() is deprecated in %s/tests/xxe/disable_xxe_dom.php on line %d
65
66Warning: DOMDocument::loadXML(): I/O warning : failed to load external entity "file://%s/tests/xxe/content.txt" in /var/www/html/snuffleupagus/src/tests/xxe/disable_xxe_dom.php on line %d
67
68Warning: DOMDocument::loadXML(): Failure to process entity foo in Entity, line: 6 in %s/tests/xxe/disable_xxe_dom.php on line %d
69
70Warning: DOMDocument::loadXML(): Entity 'foo' not defined in Entity, line: 6 in %s/tests/xxe/disable_xxe_dom.php on line %d
71
72Warning: Attempt to read property "nodeValue" on null in %s/tests/xxe/disable_xxe_dom.php on line %d
73libxml_disable_entity to false:
74
75Deprecated: Function libxml_disable_entity_loader() is deprecated in %s/tests/xxe/disable_xxe_dom.php on line %d