From 92a4b93c4d420fefe590bd88521ec76d8bebd3fe Mon Sep 17 00:00:00 2001 From: jvoisin Date: Tue, 24 Oct 2017 00:16:30 +0200 Subject: Remove the `enable` member from the disable function structure Also add some more tests --- src/sp_disabled_functions.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/sp_disabled_functions.c') diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c index f089c25..f0b785c 100644 --- a/src/sp_disabled_functions.c +++ b/src/sp_disabled_functions.c @@ -124,10 +124,6 @@ bool should_disable(zend_execute_data* execute_data) { const char* arg_name = NULL; const char* arg_value_str = NULL; - if (false == config_node->enable) { - goto next; - } - /* The order matters, since when we have `config_node->functions_list`, we also do have `config_node->function` */ if (config_node->functions_list) { @@ -189,9 +185,18 @@ bool should_disable(zend_execute_data* execute_data) { bool arg_matched = false; int i = 0; - if ((config_node->pos != -1) && (config_node->pos <= nb_param)) { - i = config_node->pos; - nb_param = (config_node->pos) + 1; + if (config_node->pos != -1) { + if (config_node->pos <= nb_param) { + sp_log_err("config", "It seems that you wrote a rule filtering on the " + "%d%s argument of the function '%s', but it takes only %d arguments. " + "Matching on _all_ arguments instead.", + config_node->pos, + (config_node->pos == 1)?"st":(config_node->pos)?"nd":"th", + complete_path_function, nb_param); + } else { + i = config_node->pos; + nb_param = (config_node->pos) + 1; + } } for (; i < nb_param; i++) { @@ -301,10 +306,6 @@ static bool should_drop_on_ret(zval* return_value, sp_disabled_function const* const config_node = (sp_disabled_function*)(config->data); - if (false == config_node->enable) { - goto next; - } - if (config_node->function) { if (0 != strcmp(config_node->function, complete_path_function)) { goto next; -- cgit v1.3