diff options
| author | WhiteWinterWolf | 2021-05-09 18:56:38 +0200 |
|---|---|---|
| committer | GitHub | 2021-05-09 16:56:38 +0000 |
| commit | ec67149705739f9c13dc1f5dee335768cab3d7a0 (patch) | |
| tree | 0dd5e1b8ad7326020f27a32c1f8442f53c752bf7 /src/tests | |
| parent | 49d1664cd3708482c954ef4ffdddc54d3e7cbcf0 (diff) | |
Fix disable function chmod
Diffstat (limited to 'src/tests')
3 files changed, 32 insertions, 0 deletions
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 | ||
| 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/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-- | ||
| 2 | Disable functions - chmod | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | <?php if (PHP_VERSION_ID >= 80000) print "skip"; ?> | ||
| 6 | --INI-- | ||
| 7 | sp.configuration_file={PWD}/config/disabled_functions_chmod.ini | ||
| 8 | --FILE-- | ||
| 9 | <?php | ||
| 10 | chmod( 'foo', 0777 ); | ||
| 11 | ?> | ||
| 12 | --XFAIL-- | ||
| 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 | ||
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-- | ||
| 2 | Disable 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-- | ||
| 7 | sp.configuration_file={PWD}/config/disabled_functions_chmod.ini | ||
| 8 | --FILE-- | ||
| 9 | <?php | ||
| 10 | chmod( 'foo', 0777 ); | ||
| 11 | ?> | ||
| 12 | --XFAIL-- | ||
| 13 | --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 | ||
