diff options
| author | kkadosh | 2018-03-19 16:39:47 +0000 |
|---|---|---|
| committer | blotus | 2018-03-19 17:39:47 +0100 |
| commit | 39929ce509361ee72746a9b971bdc531fbf0b843 (patch) | |
| tree | c3455c4e4428d3b613e926b28619396960a2713e /src/tests | |
| parent | 3659eb1542270d25c36fb3f38600e85cb8b6a22b (diff) | |
The filename filter is now matching on callsite instead of implemsite (#167)
* Add match on the file where the function is called
* Add the test
* Constify some params
* Fix potentiel null deref
* Return more before if execute_data is NULL
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/config/config_disabled_functions_called_file_r.ini | 1 | ||||
| -rw-r--r-- | src/tests/disabled_functions_called_file_r.phpt | 34 |
2 files changed, 35 insertions, 0 deletions
diff --git a/src/tests/config/config_disabled_functions_called_file_r.ini b/src/tests/config/config_disabled_functions_called_file_r.ini new file mode 100644 index 0000000..17b019a --- /dev/null +++ b/src/tests/config/config_disabled_functions_called_file_r.ini | |||
| @@ -0,0 +1 @@ | |||
| sp.disable_function.function_r("test").filename_r("file_r\\.php$").drop(); \ No newline at end of file | |||
diff --git a/src/tests/disabled_functions_called_file_r.phpt b/src/tests/disabled_functions_called_file_r.phpt new file mode 100644 index 0000000..45e57a9 --- /dev/null +++ b/src/tests/disabled_functions_called_file_r.phpt | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions by matching on the filename_r where the function is called, and not defined | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) die "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/config_disabled_functions_called_file_r.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | $dir = __DIR__; | ||
| 10 | |||
| 11 | @unlink("$dir/myfunc.php"); | ||
| 12 | |||
| 13 | $mycode = <<< EOD | ||
| 14 | <?php | ||
| 15 | function test() { | ||
| 16 | echo "TOTO"; | ||
| 17 | } | ||
| 18 | ?> | ||
| 19 | EOD; | ||
| 20 | |||
| 21 | file_put_contents("$dir/myfunc.php", $mycode); | ||
| 22 | |||
| 23 | include "$dir/myfunc.php"; | ||
| 24 | |||
| 25 | test(); | ||
| 26 | |||
| 27 | ?> | ||
| 28 | --EXPECTF-- | ||
| 29 | [snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'test' in %a/disabled_functions_called_file_r.php:18 has been disabled. | ||
| 30 | --CLEAN-- | ||
| 31 | <?php | ||
| 32 | $dir = __DIR__; | ||
| 33 | @unlink("$dir/myfunc.php"); | ||
| 34 | ?> | ||
