diff options
| author | jvoisin | 2019-01-14 19:29:25 +0000 |
|---|---|---|
| committer | GitHub | 2019-01-14 19:29:25 +0000 |
| commit | e79f7e3bd992c7f0915ef9afe7afb6d79740527a (patch) | |
| tree | f881c25694eb00da2331a9ab280ec1c24a5662ab /src/tests/disable_xxe_dom_disabled.phpt | |
| parent | c943db586ac46b686b49bdf61d8473e39dd93000 (diff) | |
Reorganize the testsuite
Splitting the testsuite in several components makes it easier to manage and comprehend.
This was also needed some some tests aren't passing on Alpine Linux, but we still want to run
as many of them as we can on this platform.
Diffstat (limited to 'src/tests/disable_xxe_dom_disabled.phpt')
| -rw-r--r-- | src/tests/disable_xxe_dom_disabled.phpt | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/src/tests/disable_xxe_dom_disabled.phpt b/src/tests/disable_xxe_dom_disabled.phpt deleted file mode 100644 index a791ebc..0000000 --- a/src/tests/disable_xxe_dom_disabled.phpt +++ /dev/null | |||
| @@ -1,55 +0,0 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable XXE | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php | ||
| 5 | if (!extension_loaded("snuffleupagus")) echo "skip"; | ||
| 6 | if (!extension_loaded("dom")) echo "skip"; | ||
| 7 | ?> | ||
| 8 | --INI-- | ||
| 9 | sp.configuration_file={PWD}/config/disable_xxe_disable.ini | ||
| 10 | --FILE-- | ||
| 11 | <?php | ||
| 12 | $dir = __DIR__; | ||
| 13 | $content = '<content>WARNING, external entity loaded!</content>'; | ||
| 14 | file_put_contents($dir . '/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> | ||
| 23 | EOD; | ||
| 24 | |||
| 25 | file_put_contents($dir . '/content.xml', $xml); | ||
| 26 | |||
| 27 | libxml_disable_entity_loader(true); | ||
| 28 | $dom = new DOMDocument('1.0'); | ||
| 29 | $dom->loadXML($xml, LIBXML_DTDATTR|LIBXML_DTDLOAD|LIBXML_NOENT); | ||
| 30 | printf("libxml_disable_entity to true: %s\n", $dom->getElementsByTagName('testing')->item(0)->nodeValue); | ||
| 31 | |||
| 32 | libxml_disable_entity_loader(false); | ||
| 33 | $dom = new DOMDocument('1.0'); | ||
| 34 | $dom->loadXML($xml, LIBXML_DTDATTR|LIBXML_DTDLOAD|LIBXML_NOENT); | ||
| 35 | printf("libxml_disable_entity to false: %s\n", $dom->getElementsByTagName('testing')->item(0)->nodeValue); | ||
| 36 | |||
| 37 | $xml = "<test><testing>foo</testing></test>"; | ||
| 38 | file_put_contents('content.xml', $xml); | ||
| 39 | |||
| 40 | libxml_disable_entity_loader(false); | ||
| 41 | $dom = new DOMDocument('1.0'); | ||
| 42 | $dom->loadXML($xml, LIBXML_DTDATTR|LIBXML_DTDLOAD|LIBXML_NOENT); | ||
| 43 | printf("without xxe: %s", $dom->getElementsByTagName('testing')->item(0)->nodeValue); | ||
| 44 | |||
| 45 | ?> | ||
| 46 | --EXPECTF-- | ||
| 47 | libxml_disable_entity to true: WARNING, external entity loaded! | ||
| 48 | libxml_disable_entity to false: WARNING, external entity loaded! | ||
| 49 | without xxe: foo | ||
| 50 | --CLEAN-- | ||
| 51 | <?php | ||
| 52 | $dir = __DIR__; | ||
| 53 | unlink($dir . "/content.xml"); | ||
| 54 | unlink($dir . "/content.txt"); | ||
| 55 | ?> | ||
