diff options
| author | xXx-caillou-xXx | 2018-08-28 14:24:29 +0200 |
|---|---|---|
| committer | jvoisin | 2018-08-28 12:24:29 +0000 |
| commit | aa5d6895d0ac8c6ea050a8ea55e2f8a39ddfe365 (patch) | |
| tree | c640e50ab007bae3a2fd55ca05bc13c73e293c69 /src/sp_disabled_functions.c | |
| parent | eff2c658d37108020215f838d4c47c176ec3e050 (diff) | |
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
Diffstat (limited to 'src/sp_disabled_functions.c')
| -rw-r--r-- | src/sp_disabled_functions.c | 13 |
1 files changed, 4 insertions, 9 deletions
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, | |||
| 105 | if (config_node->pos != -1) { | 105 | if (config_node->pos != -1) { |
| 106 | if (config_node->pos > nb_param - 1) { | 106 | if (config_node->pos > nb_param - 1) { |
| 107 | char* complete_function_path = get_complete_function_path(execute_data); | 107 | char* complete_function_path = get_complete_function_path(execute_data); |
| 108 | sp_log_err("config", | 108 | sp_log_warn("config", |
| 109 | "It seems that you wrote a rule filtering on the " | 109 | "It seems that you wrote a rule filtering on the " |
| 110 | "%d%s argument of the function '%s', but it takes only %d " | 110 | "%d%s argument of the function '%s', but it takes only %d " |
| 111 | "arguments. " | 111 | "arguments. " |
| @@ -290,8 +290,6 @@ bool should_disable(zend_execute_data* execute_data, | |||
| 290 | const char* builtin_param_name, const sp_list_node* config, | 290 | const char* builtin_param_name, const sp_list_node* config, |
| 291 | const zend_string* current_filename) { | 291 | const zend_string* current_filename) { |
| 292 | char current_file_hash[SHA256_SIZE * 2 + 1] = {0}; | 292 | char current_file_hash[SHA256_SIZE * 2 + 1] = {0}; |
| 293 | unsigned int line = 0; | ||
| 294 | char* filename = NULL; | ||
| 295 | 293 | ||
| 296 | while (config) { | 294 | while (config) { |
| 297 | sp_disabled_function const* const config_node = | 295 | sp_disabled_function const* const config_node = |
| @@ -327,9 +325,6 @@ bool should_disable(zend_execute_data* execute_data, | |||
| 327 | is_file_matching(execute_data, config_node, current_filename); | 325 | is_file_matching(execute_data, config_node, current_filename); |
| 328 | if (!ex) { | 326 | if (!ex) { |
| 329 | goto next; | 327 | goto next; |
| 330 | } else if (ex != execute_data) { | ||
| 331 | line = ex->opline->lineno; | ||
| 332 | filename = ZSTR_VAL(ex->func->op_array.filename); | ||
| 333 | } | 328 | } |
| 334 | } | 329 | } |
| 335 | 330 | ||
| @@ -360,7 +355,7 @@ bool should_disable(zend_execute_data* execute_data, | |||
| 360 | (config_node->pos != -1)) { | 355 | (config_node->pos != -1)) { |
| 361 | if (!builtin_param && | 356 | if (!builtin_param && |
| 362 | execute_data->func->op_array.arg_info->is_variadic) { | 357 | execute_data->func->op_array.arg_info->is_variadic) { |
| 363 | sp_log_err( | 358 | sp_log_warn( |
| 364 | "disable_function", | 359 | "disable_function", |
| 365 | "Snuffleupagus doesn't support variadic functions yet, sorry. " | 360 | "Snuffleupagus doesn't support variadic functions yet, sorry. " |
| 366 | "Check https://github.com/nbs-system/snuffleupagus/issues/164 for " | 361 | "Check https://github.com/nbs-system/snuffleupagus/issues/164 for " |
| @@ -391,10 +386,10 @@ bool should_disable(zend_execute_data* execute_data, | |||
| 391 | 386 | ||
| 392 | if (config_node->functions_list) { | 387 | if (config_node->functions_list) { |
| 393 | sp_log_disable(ZSTR_VAL(config_node->function), arg_name, arg_value_str, | 388 | sp_log_disable(ZSTR_VAL(config_node->function), arg_name, arg_value_str, |
| 394 | config_node, line, filename); | 389 | config_node); |
| 395 | } else { | 390 | } else { |
| 396 | sp_log_disable(complete_function_path, arg_name, arg_value_str, | 391 | sp_log_disable(complete_function_path, arg_name, arg_value_str, |
| 397 | config_node, line, filename); | 392 | config_node); |
| 398 | } | 393 | } |
| 399 | if (true == config_node->simulation) { | 394 | if (true == config_node->simulation) { |
| 400 | goto next; | 395 | goto next; |
