summaryrefslogtreecommitdiff
path: root/src/tests/disable_function
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/disable_function')
-rw-r--r--src/tests/disable_function/config/disabled_functions.ini1
-rw-r--r--src/tests/disable_function/config/disabled_functions_chmod.ini4
-rw-r--r--src/tests/disable_function/disabled_functions_chmod.phpt14
-rw-r--r--src/tests/disable_function/disabled_functions_chmod_php8.phpt14
-rw-r--r--src/tests/disable_function/disabled_functions_shell_exec_wrong.phpt14
5 files changed, 47 insertions, 0 deletions
diff --git a/src/tests/disable_function/config/disabled_functions.ini b/src/tests/disable_function/config/disabled_functions.ini
index df7013f..0758c98 100644
--- a/src/tests/disable_function/config/disabled_functions.ini
+++ b/src/tests/disable_function/config/disabled_functions.ini
@@ -7,3 +7,4 @@ sp.disable_function.function_r("^var_dump$").drop();
7sp.disable_function.function("sprintf").filename("/wrong file name").drop(); 7sp.disable_function.function("sprintf").filename("/wrong file name").drop();
8sp.disable_function.function("sprintf").filename("/wrong file name").drop(); 8sp.disable_function.function("sprintf").filename("/wrong file name").drop();
9sp.disable_function.function("eval").drop(); 9sp.disable_function.function("eval").drop();
10sp.disable_function.function("shell_exec").param("foo").value("bar").drop();
diff --git a/src/tests/disable_function/config/disabled_functions_chmod.ini b/src/tests/disable_function/config/disabled_functions_chmod.ini
new file mode 100644
index 0000000..e601900
--- /dev/null
+++ b/src/tests/disable_function/config/disabled_functions_chmod.ini
@@ -0,0 +1,4 @@
1# PHP7 and below
2sp.disable_function.function("chmod").param("mode").value("511").drop();
3# PHP8
4sp.disable_function.function("chmod").param("permissions").value("511").drop();
diff --git a/src/tests/disable_function/disabled_functions_chmod.phpt b/src/tests/disable_function/disabled_functions_chmod.phpt
new file mode 100644
index 0000000..28f948d
--- /dev/null
+++ b/src/tests/disable_function/disabled_functions_chmod.phpt
@@ -0,0 +1,14 @@
1--TEST--
2Disable functions - chmod
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?>
5<?php if (PHP_VERSION_ID >= 80000) print "skip"; ?>
6--INI--
7sp.configuration_file={PWD}/config/disabled_functions_chmod.ini
8--FILE--
9<?php
10chmod( 'foo', 0777 );
11?>
12--XFAIL--
13--EXPECTF--
14Fatal 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
diff --git a/src/tests/disable_function/disabled_functions_chmod_php8.phpt b/src/tests/disable_function/disabled_functions_chmod_php8.phpt
new file mode 100644
index 0000000..71bb034
--- /dev/null
+++ b/src/tests/disable_function/disabled_functions_chmod_php8.phpt
@@ -0,0 +1,14 @@
1--TEST--
2Disable functions - chmod, in php8
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?>
5<?php if (PHP_VERSION_ID < 80000) print "skip"; ?>
6--INI--
7sp.configuration_file={PWD}/config/disabled_functions_chmod.ini
8--FILE--
9<?php
10chmod( 'foo', 0777 );
11?>
12--XFAIL--
13--EXPECTF--
14Fatal 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
diff --git a/src/tests/disable_function/disabled_functions_shell_exec_wrong.phpt b/src/tests/disable_function/disabled_functions_shell_exec_wrong.phpt
new file mode 100644
index 0000000..fe8e73a
--- /dev/null
+++ b/src/tests/disable_function/disabled_functions_shell_exec_wrong.phpt
@@ -0,0 +1,14 @@
1--TEST--
2Disable functions - shell_exec, with a non-existing command
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?>
5--INI--
6sp.configuration_file={PWD}/config/disabled_functions.ini
7--FILE--
8<?php
9$gs = exec( 'foo' );
10echo "YES";
11?>
12--EXPECTF--
13%snot found
14YES