From 39929ce509361ee72746a9b971bdc531fbf0b843 Mon Sep 17 00:00:00 2001 From: kkadosh Date: Mon, 19 Mar 2018 16:39:47 +0000 Subject: 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 --- .../config_disabled_functions_called_file_r.ini | 1 + src/tests/disabled_functions_called_file_r.phpt | 34 ++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/tests/config/config_disabled_functions_called_file_r.ini create mode 100644 src/tests/disabled_functions_called_file_r.phpt (limited to 'src/tests') 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 @@ +--TEST-- +Disable functions by matching on the filename_r where the function is called, and not defined +--SKIPIF-- + +--INI-- +sp.configuration_file={PWD}/config/config_disabled_functions_called_file_r.ini +--FILE-- + +EOD; + +file_put_contents("$dir/myfunc.php", $mycode); + +include "$dir/myfunc.php"; + +test(); + +?> +--EXPECTF-- +[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. +--CLEAN-- + -- cgit v1.3