diff options
| author | Sebastien Blot | 2017-09-20 10:11:01 +0200 |
|---|---|---|
| committer | Sebastien Blot | 2017-09-20 10:11:01 +0200 |
| commit | 868f96c759b6650d88ff9f4fbc5c048302134248 (patch) | |
| tree | c0de0af318bf77a8959164ef11aeeeb2b7bab294 /src/tests/deny_writable_execution_disabled.phpt | |
Initial import
Diffstat (limited to 'src/tests/deny_writable_execution_disabled.phpt')
| -rw-r--r-- | src/tests/deny_writable_execution_disabled.phpt | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/tests/deny_writable_execution_disabled.phpt b/src/tests/deny_writable_execution_disabled.phpt new file mode 100644 index 0000000..6d1233b --- /dev/null +++ b/src/tests/deny_writable_execution_disabled.phpt | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | --TEST-- | ||
| 2 | Readonly execution attempt | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/config_disable_writable_disabled.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | $dir = __DIR__; | ||
| 10 | |||
| 11 | // just in case | ||
| 12 | @unlink("$dir/non_writable_file.txt"); | ||
| 13 | @unlink("$dir/writable_file.txt"); | ||
| 14 | |||
| 15 | file_put_contents("$dir/writable_file.txt", '<?php echo "Code execution within a writable file.\n";'); | ||
| 16 | file_put_contents("$dir/non_writable_file.txt", '<?php echo "Code execution within a non-writable file.\n";'); | ||
| 17 | chmod("$dir/writable_file.txt", 0777); | ||
| 18 | chmod("$dir/non_writable_file.txt", 0400); | ||
| 19 | include "$dir/writable_file.txt"; | ||
| 20 | include "$dir/non_writable_file.txt"; | ||
| 21 | ?> | ||
| 22 | --EXPECT-- | ||
| 23 | Code execution within a writable file. | ||
| 24 | Code execution within a non-writable file. | ||
| 25 | --CLEAN-- | ||
| 26 | <?php | ||
| 27 | $dir = __DIR__; | ||
| 28 | chmod("$dir/non_writable_file.txt", 0777); | ||
| 29 | chmod("$dir/writable_file.txt", 0777); | ||
| 30 | unlink("$dir/non_writable_file.txt"); | ||
| 31 | unlink("$dir/writable_file.txt"); | ||
| 32 | ?> \ No newline at end of file | ||
