diff options
| author | kkadosh | 2018-03-19 16:13:31 +0000 |
|---|---|---|
| committer | jvoisin | 2018-03-19 17:13:31 +0100 |
| commit | 3659eb1542270d25c36fb3f38600e85cb8b6a22b (patch) | |
| tree | 35d96a86a9119b1bddc9ef3e44bc39edbc9a6fe0 /src | |
| parent | c97f0f6bc908c3241a117ee00d574fa23821743c (diff) | |
Add a failing test for callback function as parameter
Diffstat (limited to 'src')
| -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 | ||
