diff options
| -rw-r--r-- | src/tests/config/config_disabled_functions_callback_called_file_r.ini | 1 | ||||
| -rw-r--r-- | src/tests/disabled_functions_callback_called_file_r.phpt | 40 |
2 files changed, 41 insertions, 0 deletions
diff --git a/src/tests/config/config_disabled_functions_callback_called_file_r.ini b/src/tests/config/config_disabled_functions_callback_called_file_r.ini new file mode 100644 index 0000000..b076585 --- /dev/null +++ b/src/tests/config/config_disabled_functions_callback_called_file_r.ini | |||
| @@ -0,0 +1 @@ | |||
| sp.disable_function.function("test_callback").filename_r("file_r\\.php$").drop(); \ No newline at end of file | |||
diff --git a/src/tests/disabled_functions_callback_called_file_r.phpt b/src/tests/disabled_functions_callback_called_file_r.phpt new file mode 100644 index 0000000..e1740c5 --- /dev/null +++ b/src/tests/disabled_functions_callback_called_file_r.phpt | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions by matching on the filename_r where the callback 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_callback_called_file_r.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | $dir = __DIR__; | ||
| 10 | |||
| 11 | @unlink("$dir/myfunc_callback.php"); | ||
| 12 | |||
| 13 | $mycode = <<< 'EOD' | ||
| 14 | <?php | ||
| 15 | |||
| 16 | function test_callback() { | ||
| 17 | return "Test_callback"; | ||
| 18 | } | ||
| 19 | |||
| 20 | function test(callable $toto) { | ||
| 21 | return $toto(); | ||
| 22 | } | ||
| 23 | ?> | ||
| 24 | EOD; | ||
| 25 | |||
| 26 | file_put_contents("$dir/myfunc_callback.php", $mycode); | ||
| 27 | |||
| 28 | include "$dir/myfunc_callback.php"; | ||
| 29 | |||
| 30 | echo test('test_callback'); | ||
| 31 | |||
| 32 | ?> | ||
| 33 | --EXPECTF-- | ||
| 34 | [snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'test_callback' in %a/disabled_functions_callback__called_file_r.php:%d has been disabled. | ||
| 35 | --XFAIL-- | ||
| 36 | --CLEAN-- | ||
| 37 | <?php | ||
| 38 | $dir = __DIR__; | ||
| 39 | @unlink("$dir/myfunc_callback.php"); | ||
| 40 | ?> \ No newline at end of file | ||
