summaryrefslogtreecommitdiff
path: root/src/tests/disable_xxe_simplexml_oop.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/disable_xxe_simplexml_oop.phpt')
-rw-r--r--src/tests/disable_xxe_simplexml_oop.phpt51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/tests/disable_xxe_simplexml_oop.phpt b/src/tests/disable_xxe_simplexml_oop.phpt
deleted file mode 100644
index 43c4fbf..0000000
--- a/src/tests/disable_xxe_simplexml_oop.phpt
+++ /dev/null
@@ -1,51 +0,0 @@
1--TEST--
2Disable XXE
3--SKIPIF--
4<?php
5 if (!extension_loaded("snuffleupagus")) echo "skip";
6 if (!extension_loaded("simplexml")) echo "skip";
7 ?>
8--INI--
9sp.configuration_file={PWD}/config/disable_xxe.ini
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$doc = simplexml_load_string($xml);
29printf("libxml_disable_entity to true: %s\n", $doc->testing);
30
31libxml_disable_entity_loader(false);
32$doc = simplexml_load_string($xml);
33printf("libxml_disable_entity to false: %s\n", $doc->testing);
34
35$xml = "<test><testing>foo</testing></test>";
36file_put_contents('content.xml', $xml);
37
38$doc = simplexml_load_string($xml);
39printf("without xxe: %s", $doc->testing);
40
41?>
42--EXPECT--
43libxml_disable_entity to true:
44libxml_disable_entity to false:
45without xxe: foo
46--CLEAN--
47<?php
48$dir = __DIR__;
49unlink($dir . "/content.xml");
50unlink($dir . "/content.txt");
51?>