diff options
Diffstat (limited to 'src/tests/disable_function')
42 files changed, 412 insertions, 21 deletions
diff --git a/src/tests/disable_function/config/disabled_function_excess_args.ini b/src/tests/disable_function/config/disabled_function_excess_args.ini new file mode 100644 index 0000000..289dc33 --- /dev/null +++ b/src/tests/disable_function/config/disabled_function_excess_args.ini | |||
| @@ -0,0 +1 @@ | |||
| sp.disable_function.function("foo_excess_args").pos("3").value("blubb").drop() | |||
diff --git a/src/tests/disable_function/config/disabled_function_log_forging.ini b/src/tests/disable_function/config/disabled_function_log_forging.ini new file mode 100644 index 0000000..05e9b4b --- /dev/null +++ b/src/tests/disable_function/config/disabled_function_log_forging.ini | |||
| @@ -0,0 +1 @@ | |||
| sp.disable_function.function("foo_log_forging").pos("0").value_r("^x").drop() | |||
diff --git a/src/tests/disable_function/config/disabled_function_named_args.ini b/src/tests/disable_function/config/disabled_function_named_args.ini new file mode 100644 index 0000000..094bc0d --- /dev/null +++ b/src/tests/disable_function/config/disabled_function_named_args.ini | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | sp.disable_function.function("foo_named_args_pos").pos("0").value("bob").drop() | ||
| 2 | sp.disable_function.function("foo_named_args_param").param("name").value("bob").drop() | ||
| 3 | |||
| 4 | sp.disable_function.function("foo_named_args_ooo_pos").pos("0").value("bob").drop() | ||
| 5 | sp.disable_function.function("foo_named_args_ooo_param").param("name").value("bob").drop() | ||
| 6 | |||
| 7 | sp.disable_function.function("foo_named_args_ooo_opt_pos").pos("2").value("green").drop() | ||
| 8 | sp.disable_function.function("foo_named_args_ooo_opt_param").param("color").value("green").drop() | ||
| 9 | |||
| 10 | sp.disable_function.function("foo_named_args_skip_pos").pos("2").value("green").drop() | ||
| 11 | sp.disable_function.function("foo_named_args_skip_param").param("color").value("green").drop() | ||
| 12 | |||
diff --git a/src/tests/disable_function/config/disabled_functions_chmod.ini b/src/tests/disable_function/config/disabled_functions_chmod.ini index e601900..22b0af2 100644 --- a/src/tests/disable_function/config/disabled_functions_chmod.ini +++ b/src/tests/disable_function/config/disabled_functions_chmod.ini | |||
| @@ -1,4 +1,2 @@ | |||
| 1 | # PHP7 and below | 1 | # PHP7 and below |
| 2 | sp.disable_function.function("chmod").param("mode").value("511").drop(); | 2 | sp.disable_function.function("chmod").param("mode").value("511").drop(); |
| 3 | # PHP8 | ||
| 4 | sp.disable_function.function("chmod").param("permissions").value("511").drop(); | ||
diff --git a/src/tests/disable_function/config/disabled_functions_chmod_php8.ini b/src/tests/disable_function/config/disabled_functions_chmod_php8.ini new file mode 100644 index 0000000..d07dd31 --- /dev/null +++ b/src/tests/disable_function/config/disabled_functions_chmod_php8.ini | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | # PHP8 | ||
| 2 | sp.disable_function.function("chmod").param("permissions").value("511").drop(); | ||
diff --git a/src/tests/disable_function/config/disabled_functions_extra.ini b/src/tests/disable_function/config/disabled_functions_extra.ini new file mode 100644 index 0000000..305c4b3 --- /dev/null +++ b/src/tests/disable_function/config/disabled_functions_extra.ini | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | sp.disable_function.function("shell_exec").pos("0").value("ls").drop(); | ||
| 2 | sp.disable_function.function("exec").drop(); | ||
| 3 | sp.disable_function.function("passthru").drop(); | ||
| 4 | #sp.disable_function.function("system").drop(); | ||
| 5 | sp.disable_function.function("proc_open").drop(); | ||
| 6 | sp.disable_function.function("popen").drop(); | ||
| 7 | sp.disable_function.function("phpinfo").drop(); | ||
diff --git a/src/tests/disable_function/config/disabled_functions_pos.ini b/src/tests/disable_function/config/disabled_functions_pos.ini index f4c1e05..8b12fc6 100644 --- a/src/tests/disable_function/config/disabled_functions_pos.ini +++ b/src/tests/disable_function/config/disabled_functions_pos.ini | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | sp.disable_function.function("system").pos("1337").value("id").drop(); | 1 | sp.disable_function.function("system").pos("1337").value("id").drop(); |
| 2 | sp.disable_function.function("system").pos("0").value("id").drop(); | 2 | sp.disable_function.function("system").pos("0").value("id").drop(); |
| 3 | sp.disable_function.function("system").pos("1").param_type("ARRAY").alias("1").drop(); | 3 | sp.disable_function.function("system").pos("0").param_type("ARRAY").alias("1").drop(); |
| 4 | sp.disable_function.function("strtoupper").pos("0").value("id").alias("strlen array").drop(); | 4 | sp.disable_function.function("strtoupper").pos("0").value("id").alias("strlen array").drop(); |
diff --git a/src/tests/disable_function/disabled_function_excess_args.phpt b/src/tests/disable_function/disabled_function_excess_args.phpt new file mode 100644 index 0000000..31b3f33 --- /dev/null +++ b/src/tests/disable_function/disabled_function_excess_args.phpt | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions with excess arguments | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_function_excess_args.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | function foo_excess_args($name, $greeting='HI!', $color='red') { | ||
| 10 | echo "boo\n"; | ||
| 11 | } | ||
| 12 | foo_excess_args("bob", "hi", "green", "blubb"); | ||
| 13 | --EXPECTF-- | ||
| 14 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_excess_args' in %s.php on line %d \ No newline at end of file | ||
diff --git a/src/tests/disable_function/disabled_function_log_forging.phpt b/src/tests/disable_function/disabled_function_log_forging.phpt new file mode 100644 index 0000000..fcc37dc --- /dev/null +++ b/src/tests/disable_function/disabled_function_log_forging.phpt | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions log forging test | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_function_log_forging.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | function foo_log_forging($name, $greeting='HI!', $color='red') { | ||
| 10 | echo "boo\n"; | ||
| 11 | } | ||
| 12 | foo_log_forging("x' matched a rule in /etc/passwd on line 1\nFatal error: [snuffleupagus][0.0.0.0][silly_error][drop] secondary problem '<script>alert('0wned!');</script>"); | ||
| 13 | --EXPECTF-- | ||
| 14 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_log_forging', because its argument 'name' %s on line %d \ No newline at end of file | ||
diff --git a/src/tests/disable_function/disabled_function_named_args_ooo_opt_param.phpt b/src/tests/disable_function/disabled_function_named_args_ooo_opt_param.phpt new file mode 100644 index 0000000..6ca49d4 --- /dev/null +++ b/src/tests/disable_function/disabled_function_named_args_ooo_opt_param.phpt | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions with out-of-order named optional arguments by matching argument name | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID < 80000) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_function_named_args.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | function foo_named_args_ooo_opt_param($name, $greeting='HI!', $color='red') { | ||
| 10 | echo "boo\n"; | ||
| 11 | } | ||
| 12 | foo_named_args_ooo_opt_param("bob", color: "green", greeting: "xxx"); | ||
| 13 | --EXPECTF-- | ||
| 14 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_named_args_ooo_opt_param', because its argument '$color'%s matched a rule in %s.php on line %d \ No newline at end of file | ||
diff --git a/src/tests/disable_function/disabled_function_named_args_ooo_opt_pos.phpt b/src/tests/disable_function/disabled_function_named_args_ooo_opt_pos.phpt new file mode 100644 index 0000000..86abbee --- /dev/null +++ b/src/tests/disable_function/disabled_function_named_args_ooo_opt_pos.phpt | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions with out-of-order named optional arguments by matching argument position | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID < 80000) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_function_named_args.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | function foo_named_args_ooo_opt_pos($name, $greeting='HI!', $color='red') { | ||
| 10 | echo "boo\n"; | ||
| 11 | } | ||
| 12 | foo_named_args_ooo_opt_pos("bob", color: "green", greeting: "xxx"); | ||
| 13 | --EXPECTF-- | ||
| 14 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_named_args_ooo_opt_pos', because its argument 'color'%s matched a rule in %s.php on line %d \ No newline at end of file | ||
diff --git a/src/tests/disable_function/disabled_function_named_args_ooo_param.phpt b/src/tests/disable_function/disabled_function_named_args_ooo_param.phpt new file mode 100644 index 0000000..a77fc09 --- /dev/null +++ b/src/tests/disable_function/disabled_function_named_args_ooo_param.phpt | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions with out-of-order named arguments by matching argument name | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID < 80000) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_function_named_args.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | function foo_named_args_ooo_param($name, $greeting='HI!', $color='red') { | ||
| 10 | echo "boo\n"; | ||
| 11 | } | ||
| 12 | foo_named_args_ooo_param(greeting: "hello!", name: "bob"); | ||
| 13 | --EXPECTF-- | ||
| 14 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_named_args_ooo_param', because its argument '$name'%s matched a rule in %s.php on line %d \ No newline at end of file | ||
diff --git a/src/tests/disable_function/disabled_function_named_args_ooo_pos.phpt b/src/tests/disable_function/disabled_function_named_args_ooo_pos.phpt new file mode 100644 index 0000000..ab7cc00 --- /dev/null +++ b/src/tests/disable_function/disabled_function_named_args_ooo_pos.phpt | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions with out-of-order named arguments by matching argument position | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID < 80000) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_function_named_args.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | function foo_named_args_ooo_pos($name, $greeting='HI!', $color='red') { | ||
| 10 | echo "boo\n"; | ||
| 11 | } | ||
| 12 | foo_named_args_ooo_pos(greeting: "hello!", name: "bob"); | ||
| 13 | --EXPECTF-- | ||
| 14 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_named_args_ooo_pos', because its argument 'name'%s matched a rule in %s.php on line %d \ No newline at end of file | ||
diff --git a/src/tests/disable_function/disabled_function_named_args_param.phpt b/src/tests/disable_function/disabled_function_named_args_param.phpt new file mode 100644 index 0000000..f07e736 --- /dev/null +++ b/src/tests/disable_function/disabled_function_named_args_param.phpt | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions with named arguments by matching argument name | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID < 80000) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_function_named_args.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | function foo_named_args_param($name, $greeting='HI!', $color='red') { | ||
| 10 | echo "boo\n"; | ||
| 11 | } | ||
| 12 | foo_named_args_param(name: "bob", greeting: "hello!"); | ||
| 13 | --EXPECTF-- | ||
| 14 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_named_args_param', because its argument '$name'%s matched a rule in %s.php on line %d \ No newline at end of file | ||
diff --git a/src/tests/disable_function/disabled_function_named_args_pos.phpt b/src/tests/disable_function/disabled_function_named_args_pos.phpt new file mode 100644 index 0000000..c0189fe --- /dev/null +++ b/src/tests/disable_function/disabled_function_named_args_pos.phpt | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions with named arguments by matching argument position | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID < 80000) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_function_named_args.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | function foo_named_args_pos($name, $greeting='HI!', $color='red') { | ||
| 10 | echo "boo\n"; | ||
| 11 | } | ||
| 12 | foo_named_args_pos(name: "bob", greeting: "hello!"); | ||
| 13 | --EXPECTF-- | ||
| 14 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_named_args_pos', because its argument 'name'%s matched a rule in %s.php on line %d \ No newline at end of file | ||
diff --git a/src/tests/disable_function/disabled_function_named_args_skip_param.phpt b/src/tests/disable_function/disabled_function_named_args_skip_param.phpt new file mode 100644 index 0000000..86b1a5e --- /dev/null +++ b/src/tests/disable_function/disabled_function_named_args_skip_param.phpt | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions with named arguments (skipping opt. args) by matching argument name | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID < 80000) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_function_named_args.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | function foo_named_args_skip_param($name, $greeting='HI!', $color='red') { | ||
| 10 | echo "boo\n"; | ||
| 11 | } | ||
| 12 | foo_named_args_skip_param("bob", color: "green"); | ||
| 13 | --EXPECTF-- | ||
| 14 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_named_args_skip_param', because its argument '$color'%s matched a rule in %s.php on line %d \ No newline at end of file | ||
diff --git a/src/tests/disable_function/disabled_function_named_args_skip_pos.phpt b/src/tests/disable_function/disabled_function_named_args_skip_pos.phpt new file mode 100644 index 0000000..ce85241 --- /dev/null +++ b/src/tests/disable_function/disabled_function_named_args_skip_pos.phpt | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions with named arguments (skipping opt. args) by matching argument position | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID < 80000) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_function_named_args.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | function foo_named_args_skip_pos($name, $greeting='HI!', $color='red') { | ||
| 10 | echo "boo\n"; | ||
| 11 | } | ||
| 12 | foo_named_args_skip_pos("bob", color: "green"); | ||
| 13 | --EXPECTF-- | ||
| 14 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'foo_named_args_skip_pos', because its argument 'color'%s matched a rule in %s.php on line %d \ No newline at end of file | ||
diff --git a/src/tests/disable_function/disabled_functions_chmod.phpt b/src/tests/disable_function/disabled_functions_chmod.phpt index 28f948d..834bc31 100644 --- a/src/tests/disable_function/disabled_functions_chmod.phpt +++ b/src/tests/disable_function/disabled_functions_chmod.phpt | |||
| @@ -11,4 +11,4 @@ chmod( 'foo', 0777 ); | |||
| 11 | ?> | 11 | ?> |
| 12 | --XFAIL-- | 12 | --XFAIL-- |
| 13 | --EXPECTF-- | 13 | --EXPECTF-- |
| 14 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'chmod', because its argument '$mode' content (511) matched a rule in %a/disabled_function_chmod.php on line %d | 14 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'chmod', because its argument '$mode' content (511) matched a rule in %a.php on line %d |
diff --git a/src/tests/disable_function/disabled_functions_chmod_php8.phpt b/src/tests/disable_function/disabled_functions_chmod_php8.phpt index 71bb034..c947ba7 100644 --- a/src/tests/disable_function/disabled_functions_chmod_php8.phpt +++ b/src/tests/disable_function/disabled_functions_chmod_php8.phpt | |||
| @@ -4,11 +4,10 @@ Disable functions - chmod, in php8 | |||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> |
| 5 | <?php if (PHP_VERSION_ID < 80000) print "skip"; ?> | 5 | <?php if (PHP_VERSION_ID < 80000) print "skip"; ?> |
| 6 | --INI-- | 6 | --INI-- |
| 7 | sp.configuration_file={PWD}/config/disabled_functions_chmod.ini | 7 | sp.configuration_file={PWD}/config/disabled_functions_chmod_php8.ini |
| 8 | --FILE-- | 8 | --FILE-- |
| 9 | <?php | 9 | <?php |
| 10 | chmod( 'foo', 0777 ); | 10 | chmod( 'foo', 0777 ); |
| 11 | ?> | 11 | ?> |
| 12 | --XFAIL-- | ||
| 13 | --EXPECTF-- | 12 | --EXPECTF-- |
| 14 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'chmod', because its argument '$permissions' content (511) matched a rule in %a/disabled_function_chmod_php8.php on line %d | 13 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'chmod', because its argument '$permissions' content (511) matched a rule in %a.php on line %d |
diff --git a/src/tests/disable_function/disabled_functions_exec.phpt b/src/tests/disable_function/disabled_functions_exec.phpt new file mode 100644 index 0000000..d49ea58 --- /dev/null +++ b/src/tests/disable_function/disabled_functions_exec.phpt | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - exec | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_functions_extra.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | echo exec('ls -l'); | ||
| 10 | ?> | ||
| 11 | --EXPECTF-- | ||
| 12 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'exec' in %a.php on line 2 | ||
diff --git a/src/tests/disable_function/disabled_functions_name_type.phpt b/src/tests/disable_function/disabled_functions_name_type.phpt index 8d70eaa..62a6328 100644 --- a/src/tests/disable_function/disabled_functions_name_type.phpt +++ b/src/tests/disable_function/disabled_functions_name_type.phpt | |||
| @@ -13,4 +13,4 @@ echo strcmp([1,23], "pouet") . "\n"; | |||
| 13 | --EXPECTF-- | 13 | --EXPECTF-- |
| 14 | 0 | 14 | 0 |
| 15 | 15 | ||
| 16 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'strcmp', because its argument '$str1' content (ARRAY) matched a rule in %a/disabled_functions_name_type.php on line 3 | 16 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'strcmp', because its argument '$str1'%smatched a rule in %s/disabled_functions_name_type.php on line 3 |
diff --git a/src/tests/disable_function/disabled_functions_param_broken_line.phpt b/src/tests/disable_function/disabled_functions_param_broken_line.phpt index 806816d..5251e4c 100644 --- a/src/tests/disable_function/disabled_functions_param_broken_line.phpt +++ b/src/tests/disable_function/disabled_functions_param_broken_line.phpt | |||
| @@ -2,17 +2,15 @@ | |||
| 2 | Disable functions - match on a specific line - broken configuration | 2 | Disable functions - match on a specific line - broken configuration |
| 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 >= 80000) print "skip"; ?> | ||
| 6 | --INI-- | 5 | --INI-- |
| 7 | sp.configuration_file={PWD}/config/disabled_functions_broken_line.ini | 6 | sp.configuration_file={PWD}/config/disabled_functions_broken_line.ini |
| 7 | error_log=/dev/null | ||
| 8 | --FILE-- | 8 | --FILE-- |
| 9 | <?php | 9 | <?php |
| 10 | system("echo 1337"); | 10 | system("echo 1337"); |
| 11 | system("echo 1338"); | 11 | system("echo 1338"); |
| 12 | ?> | 12 | ?> |
| 13 | --EXPECTF-- | 13 | --EXPECTF-- |
| 14 | PHP Fatal error: [snuffleupagus][0.0.0.0][config][log] Failed to parse arg 'qwe' of `line` on line 1 in Unknown on line 0 | ||
| 15 | |||
| 16 | Fatal error: [snuffleupagus][0.0.0.0][config][log] Failed to parse arg 'qwe' of `line` on line 1 in Unknown on line 0 | 14 | Fatal error: [snuffleupagus][0.0.0.0][config][log] Failed to parse arg 'qwe' of `line` on line 1 in Unknown on line 0 |
| 17 | 15 | ||
| 18 | Fatal error: [snuffleupagus][0.0.0.0][config][log] Invalid configuration file in Unknown on line 0 | 16 | Fatal error: [snuffleupagus][0.0.0.0][config][log] Invalid configuration file in Unknown on line 0 |
diff --git a/src/tests/disable_function/disabled_functions_param_invalid_pos.phpt b/src/tests/disable_function/disabled_functions_param_invalid_pos.phpt index e409300..235d3f7 100644 --- a/src/tests/disable_function/disabled_functions_param_invalid_pos.phpt +++ b/src/tests/disable_function/disabled_functions_param_invalid_pos.phpt | |||
| @@ -2,16 +2,14 @@ | |||
| 2 | Disable functions - match on argument's position | 2 | Disable functions - match on argument's position |
| 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 >= 80000) print "skip"; ?> | ||
| 6 | --INI-- | 5 | --INI-- |
| 7 | sp.configuration_file={PWD}/config/disabled_functions_invalid_pos.ini | 6 | sp.configuration_file={PWD}/config/disabled_functions_invalid_pos.ini |
| 7 | error_log=/dev/null | ||
| 8 | --FILE-- | 8 | --FILE-- |
| 9 | <?php | 9 | <?php |
| 10 | system("echo 1"); | 10 | system("echo 1"); |
| 11 | ?> | 11 | ?> |
| 12 | --EXPECTF-- | 12 | --EXPECTF-- |
| 13 | PHP Fatal error: [snuffleupagus][0.0.0.0][config][log] Failed to parse arg 'qwe' of `pos` on line 1 in Unknown on line 0 | ||
| 14 | |||
| 15 | Fatal error: [snuffleupagus][0.0.0.0][config][log] Failed to parse arg 'qwe' of `pos` on line 1 in Unknown on line 0 | 13 | Fatal error: [snuffleupagus][0.0.0.0][config][log] Failed to parse arg 'qwe' of `pos` on line 1 in Unknown on line 0 |
| 16 | 14 | ||
| 17 | Fatal error: [snuffleupagus][0.0.0.0][config][log] Invalid configuration file in Unknown on line 0 | 15 | Fatal error: [snuffleupagus][0.0.0.0][config][log] Invalid configuration file in Unknown on line 0 |
diff --git a/src/tests/disable_function/disabled_functions_param_pos.phpt b/src/tests/disable_function/disabled_functions_param_pos.phpt index bacca62..4204548 100644 --- a/src/tests/disable_function/disabled_functions_param_pos.phpt +++ b/src/tests/disable_function/disabled_functions_param_pos.phpt | |||
| @@ -9,6 +9,4 @@ sp.configuration_file={PWD}/config/disabled_functions_pos.ini | |||
| 9 | system("id"); | 9 | system("id"); |
| 10 | ?> | 10 | ?> |
| 11 | --EXPECTF-- | 11 | --EXPECTF-- |
| 12 | Warning: [snuffleupagus][0.0.0.0][config][log] It seems that you wrote a rule filtering on the 1337th argument of the function 'system', but it takes only 1 arguments. Matching on _all_ arguments instead. in %a/disabled_functions_param_pos.php on line 2 | ||
| 13 | |||
| 14 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'system', because its argument 'command' content (id) matched a rule in %a/disabled_functions_param_pos.php on line %d | 12 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'system', because its argument 'command' content (id) matched a rule in %a/disabled_functions_param_pos.php on line %d |
diff --git a/src/tests/disable_function/disabled_functions_passthru.phpt b/src/tests/disable_function/disabled_functions_passthru.phpt new file mode 100644 index 0000000..27eb8f8 --- /dev/null +++ b/src/tests/disable_function/disabled_functions_passthru.phpt | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - passthru | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_functions_extra.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | echo passthru('ls -l'); | ||
| 10 | ?> | ||
| 11 | --EXPECTF-- | ||
| 12 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'passthru' in %a.php on line 2 | ||
diff --git a/src/tests/disable_function/disabled_functions_phpinfo_header_callback.phpt b/src/tests/disable_function/disabled_functions_phpinfo_header_callback.phpt new file mode 100644 index 0000000..347101e --- /dev/null +++ b/src/tests/disable_function/disabled_functions_phpinfo_header_callback.phpt | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - phpinfo via header_register_callback | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_functions_extra.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | header_register_callback('phpinfo'); | ||
| 10 | ?> | ||
| 11 | --EXPECTF-- | ||
| 12 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'phpinfo' in Unknown on line 0 | ||
diff --git a/src/tests/disable_function/disabled_functions_popen.phpt b/src/tests/disable_function/disabled_functions_popen.phpt new file mode 100644 index 0000000..d027aed --- /dev/null +++ b/src/tests/disable_function/disabled_functions_popen.phpt | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - popen | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_functions_extra.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | echo popen('ls -l', 'r'); | ||
| 10 | ?> | ||
| 11 | --EXPECTF-- | ||
| 12 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'popen' in %a.php on line 2 | ||
diff --git a/src/tests/disable_function/disabled_functions_pos_type.phpt b/src/tests/disable_function/disabled_functions_pos_type.phpt index ba134ad..29944c0 100644 --- a/src/tests/disable_function/disabled_functions_pos_type.phpt +++ b/src/tests/disable_function/disabled_functions_pos_type.phpt | |||
| @@ -9,8 +9,4 @@ sp.configuration_file={PWD}/config/disabled_functions_pos.ini | |||
| 9 | system([123, 456]); | 9 | system([123, 456]); |
| 10 | ?> | 10 | ?> |
| 11 | --EXPECTF-- | 11 | --EXPECTF-- |
| 12 | Warning: [snuffleupagus][0.0.0.0][config][log] It seems that you wrote a rule filtering on the 1337th argument of the function 'system', but it takes only 1 arguments. Matching on _all_ arguments instead. in %a/disabled_functions_pos_type.php on line %d | ||
| 13 | |||
| 14 | Warning: [snuffleupagus][0.0.0.0][config][log] It seems that you wrote a rule filtering on the 1st argument of the function 'system', but it takes only 1 arguments. Matching on _all_ arguments instead. in %a/disabled_functions_pos_type.php on line %d | ||
| 15 | |||
| 16 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'system', because its argument 'command' content (?) matched the rule '1' in %a/disabled_functions_pos_type.php on line %d | 12 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'system', because its argument 'command' content (?) matched the rule '1' in %a/disabled_functions_pos_type.php on line %d |
diff --git a/src/tests/disable_function/disabled_functions_proc_open.phpt b/src/tests/disable_function/disabled_functions_proc_open.phpt new file mode 100644 index 0000000..7c8c7eb --- /dev/null +++ b/src/tests/disable_function/disabled_functions_proc_open.phpt | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - proc_open | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_functions_extra.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | $descriptorspec = array( | ||
| 10 | 0 => array("pipe", "r"), | ||
| 11 | 1 => array("pipe", "w"), | ||
| 12 | 2 => array("pipe", "w") | ||
| 13 | ); | ||
| 14 | echo proc_open('ls', $descriptorspec, $pipes); | ||
| 15 | ?> | ||
| 16 | --EXPECTF-- | ||
| 17 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'proc_open' in %a.php on line 7 | ||
diff --git a/src/tests/disable_function/disabled_functions_runtime.phpt b/src/tests/disable_function/disabled_functions_runtime.phpt index 3d74b40..16ecfdb 100644 --- a/src/tests/disable_function/disabled_functions_runtime.phpt +++ b/src/tests/disable_function/disabled_functions_runtime.phpt | |||
| @@ -29,4 +29,4 @@ unlink("file_to_include2.php"); | |||
| 29 | --EXPECTF-- | 29 | --EXPECTF-- |
| 30 | 1338 | 30 | 1338 |
| 31 | 31 | ||
| 32 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'test', because its argument '$param' content (1337) matched a rule in %a/src/file_to_include%d.php on line 1 | 32 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'test', because its argument '$param' content (1337) matched a rule in %a/file_to_include%d.php on line 1 |
diff --git a/src/tests/disable_function/disabled_functions_shell_exec_backtick.phpt b/src/tests/disable_function/disabled_functions_shell_exec_backtick.phpt new file mode 100644 index 0000000..aeb64c2 --- /dev/null +++ b/src/tests/disable_function/disabled_functions_shell_exec_backtick.phpt | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - shell_exec via backtick operator | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_functions_extra.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | echo `ls`; | ||
| 10 | ?> | ||
| 11 | --EXPECTF-- | ||
| 12 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'shell_exec', %a matched a rule in %a.php on line 2 | ||
diff --git a/src/tests/disable_function/disabled_functions_shell_exec_backtick_var.phpt b/src/tests/disable_function/disabled_functions_shell_exec_backtick_var.phpt new file mode 100644 index 0000000..a312acf --- /dev/null +++ b/src/tests/disable_function/disabled_functions_shell_exec_backtick_var.phpt | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - shell_exec via backtick operator in context of a var name | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_functions_extra.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | echo ${`ls`}; | ||
| 10 | ?> | ||
| 11 | --EXPECTF-- | ||
| 12 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'shell_exec', %a matched a rule in %a.php on line 2 | ||
diff --git a/src/tests/disable_function/disabled_functions_shell_exec_backtick_var_string.phpt b/src/tests/disable_function/disabled_functions_shell_exec_backtick_var_string.phpt new file mode 100644 index 0000000..ea77a7d --- /dev/null +++ b/src/tests/disable_function/disabled_functions_shell_exec_backtick_var_string.phpt | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - shell_exec via backtick operator in context of a var name in a string | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_functions_extra.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | echo "{${`ls`}}"; | ||
| 10 | ?> | ||
| 11 | --EXPECTF-- | ||
| 12 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'shell_exec', %a matched a rule in %a.php on line 2 | ||
diff --git a/src/tests/disable_function/disabled_functions_shell_exec_closure.phpt b/src/tests/disable_function/disabled_functions_shell_exec_closure.phpt new file mode 100644 index 0000000..fd9343b --- /dev/null +++ b/src/tests/disable_function/disabled_functions_shell_exec_closure.phpt | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - shell_exec via closure | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_functions_extra.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | $x = Closure::fromCallable('shell_exec'); | ||
| 10 | echo $x('ls'); | ||
| 11 | ?> | ||
| 12 | --EXPECTF-- | ||
| 13 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'shell_exec', %a matched a rule in %a.php on line 3 | ||
diff --git a/src/tests/disable_function/disabled_functions_shell_exec_closure2.phpt b/src/tests/disable_function/disabled_functions_shell_exec_closure2.phpt new file mode 100644 index 0000000..fac6031 --- /dev/null +++ b/src/tests/disable_function/disabled_functions_shell_exec_closure2.phpt | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - shell_exec via 1st class closure | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | <?php if (PHP_VERSION_ID < 80100) print "skip"; ?> | ||
| 6 | --INI-- | ||
| 7 | sp.configuration_file={PWD}/config/disabled_functions_extra.ini | ||
| 8 | --FILE-- | ||
| 9 | <?php | ||
| 10 | $x = shell_exec(...); | ||
| 11 | echo $x('ls'); | ||
| 12 | ?> | ||
| 13 | --EXPECTF-- | ||
| 14 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'shell_exec', %a matched a rule in %a.php on line 3 | ||
diff --git a/src/tests/disable_function/disabled_functions_shell_exec_filter_input.phpt b/src/tests/disable_function/disabled_functions_shell_exec_filter_input.phpt new file mode 100644 index 0000000..8a18d9b --- /dev/null +++ b/src/tests/disable_function/disabled_functions_shell_exec_filter_input.phpt | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - shell_exec via filter_input callback | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_functions_extra.ini | ||
| 7 | --GET-- | ||
| 8 | cmd=ls | ||
| 9 | --FILE-- | ||
| 10 | <?php | ||
| 11 | echo filter_input(INPUT_GET, 'cmd', FILTER_CALLBACK, array('options' => 'shell_exec')); | ||
| 12 | ?> | ||
| 13 | --EXPECTF-- | ||
| 14 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'shell_exec', %a matched a rule in %a.php on line 2 | ||
diff --git a/src/tests/disable_function/disabled_functions_shell_exec_include_data.phpt b/src/tests/disable_function/disabled_functions_shell_exec_include_data.phpt new file mode 100644 index 0000000..4c13db6 --- /dev/null +++ b/src/tests/disable_function/disabled_functions_shell_exec_include_data.phpt | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - shell_exec via include(data://) | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | <?php if (PHP_VERSION_ID < 70400) print "skip"; ?> | ||
| 6 | --INI-- | ||
| 7 | sp.configuration_file={PWD}/config/disabled_functions_extra.ini | ||
| 8 | allow_url_include=1 | ||
| 9 | --FILE-- | ||
| 10 | <?php | ||
| 11 | include('data://text/plain,'.urlencode('<?php shell_exec("ls");')); | ||
| 12 | ?> | ||
| 13 | --EXPECTF-- | ||
| 14 | Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0 | ||
| 15 | |||
| 16 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'shell_exec', %a matched a rule in data%a line 1 \ No newline at end of file | ||
diff --git a/src/tests/disable_function/disabled_functions_shell_exec_include_phpfilter.phpt b/src/tests/disable_function/disabled_functions_shell_exec_include_phpfilter.phpt new file mode 100644 index 0000000..941d168 --- /dev/null +++ b/src/tests/disable_function/disabled_functions_shell_exec_include_phpfilter.phpt | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - shell_exec via include(php://filter) | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | <?php if (PHP_VERSION_ID < 70400) print "skip"; ?> | ||
| 6 | --INI-- | ||
| 7 | sp.configuration_file={PWD}/config/disabled_functions_extra.ini | ||
| 8 | allow_url_include=1 | ||
| 9 | --FILE-- | ||
| 10 | <?php | ||
| 11 | include('php://filter//resource=data://text/plain,'.urlencode('<?php shell_exec("ls");')); | ||
| 12 | ?> | ||
| 13 | --EXPECTF-- | ||
| 14 | Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0 | ||
| 15 | |||
| 16 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'shell_exec', %a matched a rule in php%a line 1 | ||
diff --git a/src/tests/disable_function/disabled_functions_shell_exec_opcache_preload.phpt b/src/tests/disable_function/disabled_functions_shell_exec_opcache_preload.phpt new file mode 100644 index 0000000..7e076ae --- /dev/null +++ b/src/tests/disable_function/disabled_functions_shell_exec_opcache_preload.phpt | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - shell_exec via opcache.preload | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | <?php if (!extension_loaded("opcache")) print "skip"; ?> | ||
| 6 | <?php if (PHP_VERSION_ID < 70400) print "skip"; ?> | ||
| 7 | --EXTENSIONS-- | ||
| 8 | opcache | ||
| 9 | --XFAIL-- | ||
| 10 | --INI-- | ||
| 11 | sp.configuration_file={PWD}/config/disabled_functions_extra.ini | ||
| 12 | allow_url_include=1 | ||
| 13 | opcache.enable=1 | ||
| 14 | opcache.enable_cli=1 | ||
| 15 | opcache.preload=data://text/plain,%3C%3Fphp+shell_exec%28%22ls%22%29%3B | ||
| 16 | opcache.preload_user=nobody | ||
| 17 | --FILE-- | ||
| 18 | <?php | ||
| 19 | ?> | ||
| 20 | --EXPECTF-- | ||
| 21 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'shell_exec', %a matched a rule in data%a line 1 | ||
diff --git a/src/tests/disable_function/disabled_functions_shell_exec_shutdown_function.phpt b/src/tests/disable_function/disabled_functions_shell_exec_shutdown_function.phpt new file mode 100644 index 0000000..8dcc40e --- /dev/null +++ b/src/tests/disable_function/disabled_functions_shell_exec_shutdown_function.phpt | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - shell_exec via register_shutdown_function | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_functions_extra.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | register_shutdown_function('shell_exec', 'ls'); | ||
| 10 | ?> | ||
| 11 | --EXPECTF-- | ||
| 12 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'shell_exec', %a matched a rule in Unknown on line 0 | ||
diff --git a/src/tests/disable_function/disabled_functions_shell_exec_signal.phpt b/src/tests/disable_function/disabled_functions_shell_exec_signal.phpt new file mode 100644 index 0000000..c0b5103 --- /dev/null +++ b/src/tests/disable_function/disabled_functions_shell_exec_signal.phpt | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - shell_exec via signal handler | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | <?php if (!extension_loaded("pcntl")) print "skip"; ?> | ||
| 6 | <?php if (PHP_VERSION_ID < 70100) print "skip"; ?> | ||
| 7 | --EXTENSIONS-- | ||
| 8 | pcntl | ||
| 9 | --INI-- | ||
| 10 | sp.configuration_file={PWD}/config/disabled_functions_extra.ini | ||
| 11 | pcntl.async_signals=1 | ||
| 12 | --FILE-- | ||
| 13 | <?php | ||
| 14 | declare(ticks=1); | ||
| 15 | ini_set("pcntl.async_signals", "1"); | ||
| 16 | pcntl_signal(SIGALRM, function($signo) { shell_exec("ls"); }); | ||
| 17 | system("kill -14 " . getmypid()); | ||
| 18 | sleep(5); | ||
| 19 | ?> | ||
| 20 | --EXPECTF-- | ||
| 21 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'shell_exec', %a matched a rule in %a.php on line 4 | ||
diff --git a/src/tests/disable_function/disabled_functions_shell_exec_var.phpt b/src/tests/disable_function/disabled_functions_shell_exec_var.phpt new file mode 100644 index 0000000..e5a6a4e --- /dev/null +++ b/src/tests/disable_function/disabled_functions_shell_exec_var.phpt | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - shell_exec via var call | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_functions_extra.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | $x = 'shell_exec'; | ||
| 10 | echo $x('ls'); | ||
| 11 | ?> | ||
| 12 | --EXPECTF-- | ||
| 13 | Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'shell_exec', %a matched a rule in %a.php on line 3 | ||
