From aa5d6895d0ac8c6ea050a8ea55e2f8a39ddfe365 Mon Sep 17 00:00:00 2001 From: xXx-caillou-xXx Date: Tue, 28 Aug 2018 14:24:29 +0200 Subject: Use php's logging functions This commit replace our usage of `php_log_err` with `zend_error`. This should allow administrators to display errors in the webpage, should they want to; and to properly manipulate the verbosity's level. This should close #217 --- src/sp_disabled_functions.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/sp_disabled_functions.c') diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c index b498732..3a30d55 100644 --- a/src/sp_disabled_functions.c +++ b/src/sp_disabled_functions.c @@ -105,7 +105,7 @@ static bool is_param_matching(zend_execute_data* execute_data, if (config_node->pos != -1) { if (config_node->pos > nb_param - 1) { char* complete_function_path = get_complete_function_path(execute_data); - sp_log_err("config", + sp_log_warn("config", "It seems that you wrote a rule filtering on the " "%d%s argument of the function '%s', but it takes only %d " "arguments. " @@ -290,8 +290,6 @@ bool should_disable(zend_execute_data* execute_data, const char* builtin_param_name, const sp_list_node* config, const zend_string* current_filename) { char current_file_hash[SHA256_SIZE * 2 + 1] = {0}; - unsigned int line = 0; - char* filename = NULL; while (config) { sp_disabled_function const* const config_node = @@ -327,9 +325,6 @@ bool should_disable(zend_execute_data* execute_data, is_file_matching(execute_data, config_node, current_filename); if (!ex) { goto next; - } else if (ex != execute_data) { - line = ex->opline->lineno; - filename = ZSTR_VAL(ex->func->op_array.filename); } } @@ -360,7 +355,7 @@ bool should_disable(zend_execute_data* execute_data, (config_node->pos != -1)) { if (!builtin_param && execute_data->func->op_array.arg_info->is_variadic) { - sp_log_err( + sp_log_warn( "disable_function", "Snuffleupagus doesn't support variadic functions yet, sorry. " "Check https://github.com/nbs-system/snuffleupagus/issues/164 for " @@ -391,10 +386,10 @@ bool should_disable(zend_execute_data* execute_data, if (config_node->functions_list) { sp_log_disable(ZSTR_VAL(config_node->function), arg_name, arg_value_str, - config_node, line, filename); + config_node); } else { sp_log_disable(complete_function_path, arg_name, arg_value_str, - config_node, line, filename); + config_node); } if (true == config_node->simulation) { goto next; -- cgit v1.3