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_simplexml_oop.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_simplexml_oop.phpt')
| -rw-r--r-- | src/tests/disable_xxe_simplexml_oop.phpt | 51 |
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-- | ||
| 2 | Disable XXE | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php | ||
| 5 | if (!extension_loaded("snuffleupagus")) echo "skip"; | ||
| 6 | if (!extension_loaded("simplexml")) echo "skip"; | ||
| 7 | ?> | ||
| 8 | --INI-- | ||
| 9 | sp.configuration_file={PWD}/config/disable_xxe.ini | ||
| 10 | --FILE-- | ||
| 11 | <?php | ||
| 12 | $dir = __DIR__; | ||
| 13 | $content = 'WARNING, external entity loaded!'; | ||
| 14 | file_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> | ||
| 23 | EOD; | ||
| 24 | |||
| 25 | file_put_contents('content.xml', $xml); | ||
| 26 | |||
| 27 | libxml_disable_entity_loader(true); | ||
| 28 | $doc = simplexml_load_string($xml); | ||
| 29 | printf("libxml_disable_entity to true: %s\n", $doc->testing); | ||
| 30 | |||
| 31 | libxml_disable_entity_loader(false); | ||
| 32 | $doc = simplexml_load_string($xml); | ||
| 33 | printf("libxml_disable_entity to false: %s\n", $doc->testing); | ||
| 34 | |||
| 35 | $xml = "<test><testing>foo</testing></test>"; | ||
| 36 | file_put_contents('content.xml', $xml); | ||
| 37 | |||
| 38 | $doc = simplexml_load_string($xml); | ||
| 39 | printf("without xxe: %s", $doc->testing); | ||
| 40 | |||
| 41 | ?> | ||
| 42 | --EXPECT-- | ||
| 43 | libxml_disable_entity to true: | ||
| 44 | libxml_disable_entity to false: | ||
| 45 | without xxe: foo | ||
| 46 | --CLEAN-- | ||
| 47 | <?php | ||
| 48 | $dir = __DIR__; | ||
| 49 | unlink($dir . "/content.xml"); | ||
| 50 | unlink($dir . "/content.txt"); | ||
| 51 | ?> | ||
