diff options
| author | jvoisin | 2022-12-10 12:00:36 +0100 |
|---|---|---|
| committer | jvoisin | 2022-12-11 18:36:26 +0100 |
| commit | eb570f29daa42fd8b90ecfff75382846e51b3a15 (patch) | |
| tree | 5d14199f0e9f97ec521aa69d2c55f14b21d94db7 /src | |
| parent | 808e7bff7e17b4f22a64120162734301aa065db0 (diff) | |
Add support for PHP8.2
Diffstat (limited to 'src')
20 files changed, 99 insertions, 128 deletions
diff --git a/src/tests/deny_writable/deny_writable_execution_disabled.phpt b/src/tests/deny_writable/deny_writable_execution_disabled.phpt index dd01f01..0fd19f4 100644 --- a/src/tests/deny_writable/deny_writable_execution_disabled.phpt +++ b/src/tests/deny_writable/deny_writable_execution_disabled.phpt | |||
| @@ -18,15 +18,13 @@ chmod("$dir/writable_file.txt", 0777); | |||
| 18 | chmod("$dir/non_writable_file.txt", 0400); | 18 | chmod("$dir/non_writable_file.txt", 0400); |
| 19 | include "$dir/writable_file.txt"; | 19 | include "$dir/writable_file.txt"; |
| 20 | include "$dir/non_writable_file.txt"; | 20 | include "$dir/non_writable_file.txt"; |
| 21 | ?> | 21 | |
| 22 | --EXPECT-- | 22 | // Clean up |
| 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); | 23 | chmod("$dir/non_writable_file.txt", 0777); |
| 29 | chmod("$dir/writable_file.txt", 0777); | 24 | chmod("$dir/writable_file.txt", 0777); |
| 30 | unlink("$dir/non_writable_file.txt"); | 25 | unlink("$dir/non_writable_file.txt"); |
| 31 | unlink("$dir/writable_file.txt"); | 26 | unlink("$dir/writable_file.txt"); |
| 32 | ?> | 27 | ?> |
| 28 | --EXPECT-- | ||
| 29 | Code execution within a writable file. | ||
| 30 | Code execution within a non-writable file. | ||
diff --git a/src/tests/disable_function/disabled_functions_callback_called_file_r.phpt b/src/tests/disable_function/disabled_functions_callback_called_file_r.phpt index ec75d74..d977733 100644 --- a/src/tests/disable_function/disabled_functions_callback_called_file_r.phpt +++ b/src/tests/disable_function/disabled_functions_callback_called_file_r.phpt | |||
| @@ -30,10 +30,5 @@ include "$dir/myfunc_callback.php"; | |||
| 30 | echo test('test_callback'); | 30 | echo test('test_callback'); |
| 31 | 31 | ||
| 32 | ?> | 32 | ?> |
| 33 | --CLEAN-- | ||
| 34 | <?php | ||
| 35 | $dir = __DIR__; | ||
| 36 | @unlink("$dir/myfunc_callback.php"); | ||
| 37 | ?> | ||
| 38 | --EXPECTF-- | 33 | --EXPECTF-- |
| 39 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'test_callback' in %a/myfunc_callback.php on line 4 | 34 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'test_callback' in %a/myfunc_callback.php on line 4 |
diff --git a/src/tests/disable_function/disabled_functions_called_file_r.phpt b/src/tests/disable_function/disabled_functions_called_file_r.phpt index dde26f7..2ba06d4 100644 --- a/src/tests/disable_function/disabled_functions_called_file_r.phpt +++ b/src/tests/disable_function/disabled_functions_called_file_r.phpt | |||
| @@ -25,10 +25,5 @@ include "$dir/myfunc.php"; | |||
| 25 | test(); | 25 | test(); |
| 26 | 26 | ||
| 27 | ?> | 27 | ?> |
| 28 | --CLEAN-- | ||
| 29 | <?php | ||
| 30 | $dir = __DIR__; | ||
| 31 | @unlink("$dir/myfunc.php"); | ||
| 32 | ?> | ||
| 33 | --EXPECTF-- | 28 | --EXPECTF-- |
| 34 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'test' in %a/myfunc.php on line 3 | 29 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'test' in %a/myfunc.php on line 3 |
diff --git a/src/tests/disable_function/disabled_functions_include_once.phpt b/src/tests/disable_function/disabled_functions_include_once.phpt index 57cb5a1..8b1bec8 100644 --- a/src/tests/disable_function/disabled_functions_include_once.phpt +++ b/src/tests/disable_function/disabled_functions_include_once.phpt | |||
| @@ -7,21 +7,20 @@ sp.configuration_file={PWD}/config/config_disabled_functions_include.ini | |||
| 7 | --FILE-- | 7 | --FILE-- |
| 8 | <?php | 8 | <?php |
| 9 | $dir = __DIR__; | 9 | $dir = __DIR__; |
| 10 | |||
| 11 | // Just inc ase | ||
| 12 | @unlink($dir . '/test.bla'); | ||
| 13 | @unlink($dir . '/test.sim'); | ||
| 14 | |||
| 10 | file_put_contents($dir . '/test.bla', "BLA\n"); | 15 | file_put_contents($dir . '/test.bla', "BLA\n"); |
| 11 | file_put_contents($dir . '/test.sim', "MEH\n"); | 16 | file_put_contents($dir . '/test.sim', "MEH\n"); |
| 12 | include_once $dir . '/test.bla'; | 17 | include_once $dir . '/test.bla'; |
| 13 | include_once $dir . '/test.sim'; | 18 | include_once $dir . '/test.sim'; |
| 14 | echo "1337\n"; | 19 | echo "1337\n"; |
| 15 | ?> | 20 | ?> |
| 16 | --CLEAN-- | ||
| 17 | <?php | ||
| 18 | $dir = __DIR__; | ||
| 19 | unlink($dir . '/test.bla'); | ||
| 20 | unlink($dir . '/test.sim'); | ||
| 21 | ?> | ||
| 22 | --EXPECTF-- | 21 | --EXPECTF-- |
| 23 | BLA | 22 | BLA |
| 24 | 23 | ||
| 25 | Warning: [snuffleupagus][0.0.0.0][disabled_function][simulation] Aborted execution on call of the function 'include_once', because its argument 'inclusion path' content (%a/test.sim) matched a rule in %a/disabled_functions_include_once.php on line 6 | 24 | Warning: [snuffleupagus][0.0.0.0][disabled_function][simulation] Aborted execution on call of the function 'include_once', because its argument 'inclusion path' content (%a/test.sim) matched a rule in %a/disabled_functions_include_once.php on line %d |
| 26 | MEH | 25 | MEH |
| 27 | 1337 | 26 | 1337 |
diff --git a/src/tests/disable_function/disabled_functions_include_simulation.phpt b/src/tests/disable_function/disabled_functions_include_simulation.phpt index 53ea2a4..cf2c693 100644 --- a/src/tests/disable_function/disabled_functions_include_simulation.phpt +++ b/src/tests/disable_function/disabled_functions_include_simulation.phpt | |||
| @@ -7,21 +7,20 @@ sp.configuration_file={PWD}/config/config_disabled_functions_include.ini | |||
| 7 | --FILE-- | 7 | --FILE-- |
| 8 | <?php | 8 | <?php |
| 9 | $dir = __DIR__; | 9 | $dir = __DIR__; |
| 10 | |||
| 11 | // Just in case | ||
| 12 | @unlink($dir . '/test.bla'); | ||
| 13 | @unlink($dir . '/test.sim'); | ||
| 14 | |||
| 10 | file_put_contents($dir . '/test.bla', "BLA\n"); | 15 | file_put_contents($dir . '/test.bla', "BLA\n"); |
| 11 | file_put_contents($dir . '/test.sim', "MEH\n"); | 16 | file_put_contents($dir . '/test.sim', "MEH\n"); |
| 12 | include $dir . '/test.bla'; | 17 | include $dir . '/test.bla'; |
| 13 | include $dir . '/test.sim'; | 18 | include $dir . '/test.sim'; |
| 14 | echo "1337\n"; | 19 | echo "1337\n"; |
| 15 | ?> | 20 | ?> |
| 16 | --CLEAN-- | ||
| 17 | <?php | ||
| 18 | $dir = __DIR__; | ||
| 19 | unlink($dir . '/test.bla'); | ||
| 20 | unlink($dir . '/test.sim'); | ||
| 21 | ?> | ||
| 22 | --EXPECTF-- | 21 | --EXPECTF-- |
| 23 | BLA | 22 | BLA |
| 24 | 23 | ||
| 25 | Warning: [snuffleupagus][0.0.0.0][disabled_function][simulation] Aborted execution on call of the function 'include', because its argument 'inclusion path' content (%a/test.sim) matched a rule in %a/disabled_functions_include_simulation.php on line 6 | 24 | Warning: [snuffleupagus][0.0.0.0][disabled_function][simulation] Aborted execution on call of the function 'include', because its argument 'inclusion path' content (%a/test.sim) matched a rule in %a/disabled_functions_include_simulation.php on line %d |
| 26 | MEH | 25 | MEH |
| 27 | 1337 | 26 | 1337 |
diff --git a/src/tests/disable_function/disabled_functions_require.phpt b/src/tests/disable_function/disabled_functions_require.phpt index df2b2f0..bf59b58 100644 --- a/src/tests/disable_function/disabled_functions_require.phpt +++ b/src/tests/disable_function/disabled_functions_require.phpt | |||
| @@ -7,18 +7,17 @@ sp.configuration_file={PWD}/config/config_disabled_functions_require.ini | |||
| 7 | --FILE-- | 7 | --FILE-- |
| 8 | <?php | 8 | <?php |
| 9 | $dir = __DIR__; | 9 | $dir = __DIR__; |
| 10 | |||
| 11 | // Just in case | ||
| 12 | @unlink($dir . '/test.bla'); | ||
| 13 | @unlink($dir . '/test.meh'); | ||
| 14 | |||
| 10 | file_put_contents($dir . '/test.bla', "BLA"); | 15 | file_put_contents($dir . '/test.bla', "BLA"); |
| 11 | file_put_contents($dir . '/test.meh', "MEH"); | 16 | file_put_contents($dir . '/test.meh', "MEH"); |
| 12 | require $dir . '/test.bla'; | 17 | require $dir . '/test.bla'; |
| 13 | require $dir . '/test.meh'; | 18 | require $dir . '/test.meh'; |
| 14 | echo "1337"; | 19 | echo "1337"; |
| 15 | ?> | 20 | ?> |
| 16 | --CLEAN-- | ||
| 17 | <?php | ||
| 18 | $dir = __DIR__; | ||
| 19 | unlink($dir . '/test.bla'); | ||
| 20 | unlink($dir . '/test.meh'); | ||
| 21 | ?> | ||
| 22 | --EXPECTF-- | 21 | --EXPECTF-- |
| 23 | BLA | 22 | BLA |
| 24 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'require', because its argument 'inclusion path' content (%a/test.meh) matched a rule in %a/disabled_functions_require.php on line 6 | 23 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'require', because its argument 'inclusion path' content (%a/test.meh) matched a rule in %a/disabled_functions_require.php on line %d |
diff --git a/src/tests/disable_function/disabled_functions_require_allow.phpt b/src/tests/disable_function/disabled_functions_require_allow.phpt index 7ab29aa..37a7e33 100644 --- a/src/tests/disable_function/disabled_functions_require_allow.phpt +++ b/src/tests/disable_function/disabled_functions_require_allow.phpt | |||
| @@ -7,6 +7,11 @@ sp.configuration_file={PWD}/config/config_disabled_functions_require_allow.ini | |||
| 7 | --FILE-- | 7 | --FILE-- |
| 8 | <?php | 8 | <?php |
| 9 | $dir = __DIR__; | 9 | $dir = __DIR__; |
| 10 | |||
| 11 | // Just in case | ||
| 12 | unlink($dir . '/test.bla'); | ||
| 13 | unlink($dir . '/test.meh'); | ||
| 14 | |||
| 10 | file_put_contents($dir . '/test.bla', "BLA\n"); | 15 | file_put_contents($dir . '/test.bla', "BLA\n"); |
| 11 | file_put_contents($dir . '/test.meh', "MEH\n"); | 16 | file_put_contents($dir . '/test.meh', "MEH\n"); |
| 12 | require $dir . '/test.bla'; | 17 | require $dir . '/test.bla'; |
| @@ -17,9 +22,3 @@ echo "1337"; | |||
| 17 | BLA | 22 | BLA |
| 18 | MEH | 23 | MEH |
| 19 | 1337 | 24 | 1337 |
| 20 | --CLEAN-- | ||
| 21 | <?php | ||
| 22 | $dir = __DIR__; | ||
| 23 | unlink($dir . '/test.bla'); | ||
| 24 | unlink($dir . '/test.meh'); | ||
| 25 | ?> | ||
diff --git a/src/tests/disable_function/disabled_functions_require_once.phpt b/src/tests/disable_function/disabled_functions_require_once.phpt index 7356c08..81049ef 100644 --- a/src/tests/disable_function/disabled_functions_require_once.phpt +++ b/src/tests/disable_function/disabled_functions_require_once.phpt | |||
| @@ -7,18 +7,16 @@ sp.configuration_file={PWD}/config/config_disabled_functions_require.ini | |||
| 7 | --FILE-- | 7 | --FILE-- |
| 8 | <?php | 8 | <?php |
| 9 | $dir = __DIR__; | 9 | $dir = __DIR__; |
| 10 | // Just in case | ||
| 11 | unlink($dir . '/test.bla'); | ||
| 12 | unlink($dir . '/test.meh'); | ||
| 13 | |||
| 10 | file_put_contents($dir . '/test.bla', "BLA"); | 14 | file_put_contents($dir . '/test.bla', "BLA"); |
| 11 | file_put_contents($dir . '/test.meh', "MEH"); | 15 | file_put_contents($dir . '/test.meh', "MEH"); |
| 12 | require_once $dir . '/test.bla'; | 16 | require_once $dir . '/test.bla'; |
| 13 | require_once $dir . '/test.meh'; | 17 | require_once $dir . '/test.meh'; |
| 14 | echo "1337"; | 18 | echo "1337"; |
| 15 | ?> | 19 | ?> |
| 16 | --CLEAN-- | ||
| 17 | <?php | ||
| 18 | $dir = __DIR__; | ||
| 19 | unlink($dir . '/test.bla'); | ||
| 20 | unlink($dir . '/test.meh'); | ||
| 21 | ?> | ||
| 22 | --EXPECTF-- | 20 | --EXPECTF-- |
| 23 | BLA | 21 | BLA |
| 24 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'require_once', because its argument 'inclusion path' content (%a/test.meh) matched a rule in %a/disabled_functions_require_once.php on line 6 | 22 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'require_once', because its argument 'inclusion path' content (%a/test.meh) matched a rule in %a/disabled_functions_require_once.php on line %d |
diff --git a/src/tests/disable_function/disabled_functions_require_simulation.phpt b/src/tests/disable_function/disabled_functions_require_simulation.phpt index fa1523c..2c52610 100644 --- a/src/tests/disable_function/disabled_functions_require_simulation.phpt +++ b/src/tests/disable_function/disabled_functions_require_simulation.phpt | |||
| @@ -7,21 +7,19 @@ sp.configuration_file={PWD}/config/config_disabled_functions_require.ini | |||
| 7 | --FILE-- | 7 | --FILE-- |
| 8 | <?php | 8 | <?php |
| 9 | $dir = __DIR__; | 9 | $dir = __DIR__; |
| 10 | // Just in case | ||
| 11 | @unlink($dir . '/test.bla'); | ||
| 12 | @unlink($dir . '/test.sim'); | ||
| 13 | |||
| 10 | file_put_contents($dir . '/test.bla', "BLA\n"); | 14 | file_put_contents($dir . '/test.bla', "BLA\n"); |
| 11 | file_put_contents($dir . '/test.sim', "MEH\n"); | 15 | file_put_contents($dir . '/test.sim', "MEH\n"); |
| 12 | require $dir . '/test.bla'; | 16 | require $dir . '/test.bla'; |
| 13 | require $dir . '/test.sim'; | 17 | require $dir . '/test.sim'; |
| 14 | echo "1337\n"; | 18 | echo "1337\n"; |
| 15 | ?> | 19 | ?> |
| 16 | --CLEAN-- | ||
| 17 | <?php | ||
| 18 | $dir = __DIR__; | ||
| 19 | unlink($dir . '/test.bla'); | ||
| 20 | unlink($dir . '/test.sim'); | ||
| 21 | ?> | ||
| 22 | --EXPECTF-- | 20 | --EXPECTF-- |
| 23 | BLA | 21 | BLA |
| 24 | 22 | ||
| 25 | Warning: [snuffleupagus][0.0.0.0][disabled_function][simulation] Aborted execution on call of the function 'require', because its argument 'inclusion path' content (%a/test.sim) matched a rule in %a/disabled_functions_require_simulation.php on line 6 | 23 | Warning: [snuffleupagus][0.0.0.0][disabled_function][simulation] Aborted execution on call of the function 'require', because its argument 'inclusion path' content (%a/test.sim) matched a rule in %a/disabled_functions_require_simulation.php on line %d |
| 26 | MEH | 24 | MEH |
| 27 | 1337 | 25 | 1337 |
diff --git a/src/tests/disable_function/disabled_functions_runtime.phpt b/src/tests/disable_function/disabled_functions_runtime.phpt index 16ecfdb..8175a77 100644 --- a/src/tests/disable_function/disabled_functions_runtime.phpt +++ b/src/tests/disable_function/disabled_functions_runtime.phpt | |||
| @@ -6,8 +6,12 @@ Disable functions - runtime inclusion | |||
| 6 | sp.configuration_file={PWD}/config/config_disabled_functions_param_runtime.ini | 6 | sp.configuration_file={PWD}/config/config_disabled_functions_param_runtime.ini |
| 7 | --FILE-- | 7 | --FILE-- |
| 8 | <?php | 8 | <?php |
| 9 | |||
| 10 | $dir = __DIR__; | 9 | $dir = __DIR__; |
| 10 | |||
| 11 | // Just in case | ||
| 12 | @unlink("file_to_include1.php"); | ||
| 13 | @unlink("file_to_include2.php"); | ||
| 14 | |||
| 11 | $content = '<?php function test($param) { echo $param . "\n"; }'; | 15 | $content = '<?php function test($param) { echo $param . "\n"; }'; |
| 12 | file_put_contents('file_to_include1.php', $content); | 16 | file_put_contents('file_to_include1.php', $content); |
| 13 | file_put_contents('file_to_include2.php', $content); | 17 | file_put_contents('file_to_include2.php', $content); |
| @@ -21,11 +25,6 @@ if (rand() % 2) { | |||
| 21 | test('1338');test('1337'); | 25 | test('1338');test('1337'); |
| 22 | 26 | ||
| 23 | ?> | 27 | ?> |
| 24 | --CLEAN-- | ||
| 25 | <?php | ||
| 26 | unlink("file_to_include1.php"); | ||
| 27 | unlink("file_to_include2.php"); | ||
| 28 | ?> | ||
| 29 | --EXPECTF-- | 28 | --EXPECTF-- |
| 30 | 1338 | 29 | 1338 |
| 31 | 30 | ||
diff --git a/src/tests/dump_request/dump_eval_blacklist.phpt b/src/tests/dump_request/dump_eval_blacklist.phpt index e294703..ae6ffc0 100644 --- a/src/tests/dump_request/dump_eval_blacklist.phpt +++ b/src/tests/dump_request/dump_eval_blacklist.phpt | |||
| @@ -4,15 +4,6 @@ Dump eval blacklist | |||
| 4 | <?php | 4 | <?php |
| 5 | if (!extension_loaded("snuffleupagus")) print "skip"; | 5 | if (!extension_loaded("snuffleupagus")) print "skip"; |
| 6 | ?> | 6 | ?> |
| 7 | --CLEAN-- | ||
| 8 | <?php | ||
| 9 | if (is_dir("/tmp/dump_result/")) { | ||
| 10 | foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { | ||
| 11 | @unlink($dump); | ||
| 12 | } | ||
| 13 | @rmdir("/tmp/dump_result/"); | ||
| 14 | } | ||
| 15 | ?> | ||
| 16 | --POST-- | 7 | --POST-- |
| 17 | post_a=data_post_a&post_b=data_post_b | 8 | post_a=data_post_a&post_b=data_post_b |
| 18 | --GET-- | 9 | --GET-- |
diff --git a/src/tests/dump_request/dump_eval_whitelist.phpt b/src/tests/dump_request/dump_eval_whitelist.phpt index 7385146..09f5523 100644 --- a/src/tests/dump_request/dump_eval_whitelist.phpt +++ b/src/tests/dump_request/dump_eval_whitelist.phpt | |||
| @@ -4,15 +4,6 @@ Dump eval whitelist | |||
| 4 | <?php | 4 | <?php |
| 5 | if (!extension_loaded("snuffleupagus")) print "skip"; | 5 | if (!extension_loaded("snuffleupagus")) print "skip"; |
| 6 | ?> | 6 | ?> |
| 7 | --CLEAN-- | ||
| 8 | <?php | ||
| 9 | if (is_dir("/tmp/dump_result/")) { | ||
| 10 | foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { | ||
| 11 | @unlink($dump); | ||
| 12 | } | ||
| 13 | @rmdir("/tmp/dump_result/"); | ||
| 14 | } | ||
| 15 | ?> | ||
| 16 | --POST-- | 7 | --POST-- |
| 17 | post_a=data_post_a&post_b=data_post_b | 8 | post_a=data_post_a&post_b=data_post_b |
| 18 | --GET-- | 9 | --GET-- |
diff --git a/src/tests/dump_request/dump_request.phpt b/src/tests/dump_request/dump_request.phpt index e955776..7ad0323 100644 --- a/src/tests/dump_request/dump_request.phpt +++ b/src/tests/dump_request/dump_request.phpt | |||
| @@ -6,15 +6,6 @@ if (!extension_loaded("snuffleupagus")) { | |||
| 6 | print "skip"; | 6 | print "skip"; |
| 7 | } | 7 | } |
| 8 | ?> | 8 | ?> |
| 9 | --CLEAN-- | ||
| 10 | <?php | ||
| 11 | if (is_dir("/tmp/dump_result/")) { | ||
| 12 | foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { | ||
| 13 | @unlink($dump); | ||
| 14 | } | ||
| 15 | @rmdir("/tmp/dump_result/"); | ||
| 16 | } | ||
| 17 | ?> | ||
| 18 | --POST-- | 9 | --POST-- |
| 19 | post_a=data_post_a&post_b=data_post_b | 10 | post_a=data_post_a&post_b=data_post_b |
| 20 | --GET-- | 11 | --GET-- |
| @@ -25,6 +16,13 @@ cookie_a=data_cookie_a&cookie_b=data_cookie_b | |||
| 25 | sp.configuration_file={PWD}/config/dump_request.ini | 16 | sp.configuration_file={PWD}/config/dump_request.ini |
| 26 | --FILE-- | 17 | --FILE-- |
| 27 | <?php | 18 | <?php |
| 19 | // Just in case | ||
| 20 | if (is_dir("/tmp/dump_result/")) { | ||
| 21 | foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { | ||
| 22 | @unlink($dump); | ||
| 23 | } | ||
| 24 | @rmdir("/tmp/dump_result/"); | ||
| 25 | } | ||
| 28 | echo "1\n"; | 26 | echo "1\n"; |
| 29 | system("echo 1337;"); | 27 | system("echo 1337;"); |
| 30 | $filename = glob('/tmp/dump_result/sp_dump.*')[0]; | 28 | $filename = glob('/tmp/dump_result/sp_dump.*')[0]; |
diff --git a/src/tests/dump_request/dump_request_stacktrace.phpt b/src/tests/dump_request/dump_request_stacktrace.phpt index 9f85044..765e912 100644 --- a/src/tests/dump_request/dump_request_stacktrace.phpt +++ b/src/tests/dump_request/dump_request_stacktrace.phpt | |||
| @@ -6,15 +6,6 @@ if (!extension_loaded("snuffleupagus")) { | |||
| 6 | print "skip"; | 6 | print "skip"; |
| 7 | } | 7 | } |
| 8 | ?> | 8 | ?> |
| 9 | --CLEAN-- | ||
| 10 | <?php | ||
| 11 | if (is_dir("/tmp/dump_result/")) { | ||
| 12 | foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { | ||
| 13 | @unlink($dump); | ||
| 14 | } | ||
| 15 | @rmdir("/tmp/dump_result/"); | ||
| 16 | } | ||
| 17 | ?> | ||
| 18 | --POST-- | 9 | --POST-- |
| 19 | post_a=data_post_a&post_b=data_post_b | 10 | post_a=data_post_a&post_b=data_post_b |
| 20 | --GET-- | 11 | --GET-- |
diff --git a/src/tests/dump_request/dump_request_too_big.phpt b/src/tests/dump_request/dump_request_too_big.phpt index 4fc8f81..b143bd0 100644 --- a/src/tests/dump_request/dump_request_too_big.phpt +++ b/src/tests/dump_request/dump_request_too_big.phpt | |||
| @@ -6,15 +6,6 @@ if (!extension_loaded("snuffleupagus")) { | |||
| 6 | print "skip"; | 6 | print "skip"; |
| 7 | } | 7 | } |
| 8 | ?> | 8 | ?> |
| 9 | --CLEAN-- | ||
| 10 | <?php | ||
| 11 | if (is_dir("/tmp/dump_result/")) { | ||
| 12 | foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { | ||
| 13 | @unlink($dump); | ||
| 14 | } | ||
| 15 | @rmdir("/tmp/dump_result/"); | ||
| 16 | } | ||
| 17 | ?> | ||
| 18 | --POST-- | 9 | --POST-- |
| 19 | post_a=data_post_a&post_b=data_post_b&post_c=c | 10 | post_a=data_post_a&post_b=data_post_b&post_c=c |
| 20 | --GET-- | 11 | --GET-- |
| @@ -29,6 +20,12 @@ END; | |||
| 29 | sp.configuration_file={PWD}/config/dump_request.ini | 20 | sp.configuration_file={PWD}/config/dump_request.ini |
| 30 | --FILE-- | 21 | --FILE-- |
| 31 | <?php | 22 | <?php |
| 23 | if (is_dir("/tmp/dump_result/")) { | ||
| 24 | foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) { | ||
| 25 | @unlink($dump); | ||
| 26 | } | ||
| 27 | @rmdir("/tmp/dump_result/"); | ||
| 28 | } | ||
| 32 | echo "1\n"; | 29 | echo "1\n"; |
| 33 | system("echo 1337;"); | 30 | system("echo 1337;"); |
| 34 | $filename = glob('/tmp/dump_result/*')[0]; | 31 | $filename = glob('/tmp/dump_result/*')[0]; |
diff --git a/src/tests/eval_blacklist/eval_whitelist_include_then_user.phpt b/src/tests/eval_blacklist/eval_whitelist_include_then_user.phpt index 825480f..e456ff9 100644 --- a/src/tests/eval_blacklist/eval_whitelist_include_then_user.phpt +++ b/src/tests/eval_blacklist/eval_whitelist_include_then_user.phpt | |||
| @@ -9,6 +9,9 @@ sp.configuration_file={PWD}/config/eval_whitelist.ini | |||
| 9 | $b = 1337; | 9 | $b = 1337; |
| 10 | $dir = __DIR__; | 10 | $dir = __DIR__; |
| 11 | 11 | ||
| 12 | // Just in case | ||
| 13 | @unlink($dir . '/test.bla'); | ||
| 14 | |||
| 12 | file_put_contents($dir . '/test.bla', '<?php $b = sin(1) ?>'); | 15 | file_put_contents($dir . '/test.bla', '<?php $b = sin(1) ?>'); |
| 13 | 16 | ||
| 14 | $a = cos(1); | 17 | $a = cos(1); |
| @@ -18,13 +21,8 @@ echo "After allowed eval: $a\n"; | |||
| 18 | eval("include_once('$dir' . '/test.bla');"); | 21 | eval("include_once('$dir' . '/test.bla');"); |
| 19 | echo "After eval: $b\n"; | 22 | echo "After eval: $b\n"; |
| 20 | ?> | 23 | ?> |
| 21 | --CLEAN-- | ||
| 22 | <?php | ||
| 23 | $dir = __DIR__; | ||
| 24 | unlink($dir . '/test.bla'); | ||
| 25 | ?> | ||
| 26 | --EXPECTF-- | 24 | --EXPECTF-- |
| 27 | Outside of eval: 0.54030230586814 | 25 | Outside of eval: 0.54030230586814 |
| 28 | After allowed eval: 0.28366218546323 | 26 | After allowed eval: 0.28366218546323 |
| 29 | 27 | ||
| 30 | Fatal error: [snuffleupagus][0.0.0.0][Eval_whitelist][drop] The function 'sin' isn't in the eval whitelist, dropping its call. in %a/test.bla on line 1 \ No newline at end of file | 28 | Fatal error: [snuffleupagus][0.0.0.0][Eval_whitelist][drop] The function 'sin' isn't in the eval whitelist, dropping its call. in %a/test.bla on line 1 |
diff --git a/src/tests/stream_wrapper/stream_wrapper_register.phpt b/src/tests/stream_wrapper/stream_wrapper_register.phpt index 27d8afb..4fa9ea8 100644 --- a/src/tests/stream_wrapper/stream_wrapper_register.phpt +++ b/src/tests/stream_wrapper/stream_wrapper_register.phpt | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | Stream wrapper | 2 | Stream wrapper |
| 3 | --SKIPIF-- | 3 | --SKIPIF-- |
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> |
| 5 | <?php if (PHP_VERSION_ID >= 80200) print "skip"; ?> | ||
| 5 | --INI-- | 6 | --INI-- |
| 6 | sp.configuration_file={PWD}/config/config_stream_wrapper_register.ini | 7 | sp.configuration_file={PWD}/config/config_stream_wrapper_register.ini |
| 7 | --FILE-- | 8 | --FILE-- |
diff --git a/src/tests/stream_wrapper/stream_wrapper_register_php82.phpt b/src/tests/stream_wrapper/stream_wrapper_register_php82.phpt new file mode 100644 index 0000000..b03a2f1 --- /dev/null +++ b/src/tests/stream_wrapper/stream_wrapper_register_php82.phpt | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | --TEST-- | ||
| 2 | Stream wrapper on PHP8.2+ | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | <?php if (PHP_VERSION_ID < 80200) print "skip"; ?> | ||
| 6 | --INI-- | ||
| 7 | sp.configuration_file={PWD}/config/config_stream_wrapper_register.ini | ||
| 8 | --FILE-- | ||
| 9 | <?php | ||
| 10 | class qwe { | ||
| 11 | function stream_open($fname) { | ||
| 12 | return $fname; | ||
| 13 | } | ||
| 14 | } | ||
| 15 | |||
| 16 | stream_wrapper_register("lelel", "qwe"); | ||
| 17 | stream_wrapper_register("lolol", "qwe"); | ||
| 18 | fopen("lelel://asdasd", "r"); | ||
| 19 | fopen("lolol://asdasd", "r"); | ||
| 20 | ?> | ||
| 21 | --EXPECTF-- | ||
| 22 | Deprecated: Creation of dynamic property qwe::$context is deprecated in %s/tests/stream_wrapper/stream_wrapper_register_php82.php on line %d | ||
| 23 | |||
| 24 | Warning: fopen(): Unable to find the wrapper "lolol" - did you forget to enable it when you configured PHP? in %a/stream_wrapper_register_php82.php on line %d | ||
| 25 | |||
| 26 | Warning: fopen(): file:// wrapper is disabled in the server configuration in %a/stream_wrapper_register_php82.php on line %d | ||
| 27 | |||
| 28 | Warning: fopen(lolol://asdasd): %s to open stream: no suitable wrapper could be found in %a/stream_wrapper_register_php82.php on line %d | ||
diff --git a/src/tests/xxe/disable_xxe_dom_disabled_php8.phpt b/src/tests/xxe/disable_xxe_dom_disabled_php8.phpt index 01e3349..a78fe2d 100644 --- a/src/tests/xxe/disable_xxe_dom_disabled_php8.phpt +++ b/src/tests/xxe/disable_xxe_dom_disabled_php8.phpt | |||
| @@ -10,6 +10,10 @@ dom | |||
| 10 | --FILE-- | 10 | --FILE-- |
| 11 | <?php | 11 | <?php |
| 12 | $dir = __DIR__; | 12 | $dir = __DIR__; |
| 13 | // Just in case | ||
| 14 | @unlink($dir . "/content.xml"); | ||
| 15 | @unlink($dir . "/content.txt"); | ||
| 16 | |||
| 13 | $content = '<content>WARNING, external entity loaded!</content>'; | 17 | $content = '<content>WARNING, external entity loaded!</content>'; |
| 14 | file_put_contents($dir . '/content.txt', $content); | 18 | file_put_contents($dir . '/content.txt', $content); |
| 15 | 19 | ||
| @@ -49,9 +53,3 @@ default setting with LIBXML_NOENT: WARNING, external entity loaded! | |||
| 49 | default setting without LIBXML_NOENT: | 53 | default setting without LIBXML_NOENT: |
| 50 | disabled entity loader with LIBXML_NOENT: WARNING, external entity loaded! | 54 | disabled entity loader with LIBXML_NOENT: WARNING, external entity loaded! |
| 51 | disabled entity loader without LIBXML_NOENT: | 55 | disabled entity loader without LIBXML_NOENT: |
| 52 | --CLEAN-- | ||
| 53 | <?php | ||
| 54 | $dir = __DIR__; | ||
| 55 | unlink($dir . "/content.xml"); | ||
| 56 | unlink($dir . "/content.txt"); | ||
| 57 | ?> | ||
diff --git a/src/tests/xxe/disable_xxe_dom_php8.phpt b/src/tests/xxe/disable_xxe_dom_php8.phpt index 485828f..133f87e 100644 --- a/src/tests/xxe/disable_xxe_dom_php8.phpt +++ b/src/tests/xxe/disable_xxe_dom_php8.phpt | |||
| @@ -10,6 +10,11 @@ dom | |||
| 10 | --FILE-- | 10 | --FILE-- |
| 11 | <?php | 11 | <?php |
| 12 | $dir = __DIR__; | 12 | $dir = __DIR__; |
| 13 | |||
| 14 | // Just in case | ||
| 15 | @unlink($dir . "/content.xml"); | ||
| 16 | @unlink($dir . "/content.txt"); | ||
| 17 | |||
| 13 | $content = '<content>WARNING, external entity loaded!</content>'; | 18 | $content = '<content>WARNING, external entity loaded!</content>'; |
| 14 | file_put_contents($dir . '/content.txt', $content); | 19 | file_put_contents($dir . '/content.txt', $content); |
| 15 | 20 | ||
| @@ -48,12 +53,6 @@ printf("disabled entity loader without LIBXML_NOENT: %s\n", $dom->getElementsByT | |||
| 48 | default setting with LIBXML_NOENT: WARNING, external entity loaded! | 53 | default setting with LIBXML_NOENT: WARNING, external entity loaded! |
| 49 | default setting without LIBXML_NOENT: | 54 | default setting without LIBXML_NOENT: |
| 50 | 55 | ||
| 51 | Warning: [snuffleupagus][0.0.0.0][xxe][log] A call to libxml_set_external_entity_loader was tried and nopped in %a.php on line 26 | 56 | Warning: [snuffleupagus][0.0.0.0][xxe][log] A call to libxml_set_external_entity_loader was tried and nopped in %a.php on line %d |
| 52 | disabled entity loader with LIBXML_NOENT: WARNING, external entity loaded! | 57 | disabled entity loader with LIBXML_NOENT: WARNING, external entity loaded! |
| 53 | disabled entity loader without LIBXML_NOENT: | 58 | disabled entity loader without LIBXML_NOENT: |
| 54 | --CLEAN-- | ||
| 55 | <?php | ||
| 56 | $dir = __DIR__; | ||
| 57 | unlink($dir . "/content.xml"); | ||
| 58 | unlink($dir . "/content.txt"); | ||
| 59 | ?> | ||
