diff options
| author | Julien Voisin | 2021-04-26 22:25:50 +0200 |
|---|---|---|
| committer | GitHub | 2021-04-26 20:25:50 +0000 |
| commit | 7fc7743977905807b4c2fdcde183a219ace25ba9 (patch) | |
| tree | 086f027784544b2d865e7f60a00fa61498405f90 /src/sp_var_value.c | |
| parent | 0aaa9e51bbf102c37a9f545309c07650b6ee527b (diff) | |
Make it easier to figure functions parameters' names
Diffstat (limited to 'src/sp_var_value.c')
| -rw-r--r-- | src/sp_var_value.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/sp_var_value.c b/src/sp_var_value.c index b9ac357..e351446 100644 --- a/src/sp_var_value.c +++ b/src/sp_var_value.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #include "php_snuffleupagus.h" | 1 | #include "php_snuffleupagus.h" |
| 2 | 2 | ||
| 3 | static zval *get_param_var(zend_execute_data *ed, const char *var_name) { | 3 | static zval *get_param_var(zend_execute_data *ed, const char *var_name, |
| 4 | bool print) { | ||
| 4 | unsigned int nb_param = ed->func->common.num_args; | 5 | unsigned int nb_param = ed->func->common.num_args; |
| 5 | 6 | ||
| 6 | for (unsigned int i = 0; i < nb_param; i++) { | 7 | for (unsigned int i = 0; i < nb_param; i++) { |
| @@ -13,6 +14,9 @@ static zval *get_param_var(zend_execute_data *ed, const char *var_name) { | |||
| 13 | if (0 == strcmp(arg_name, var_name)) { | 14 | if (0 == strcmp(arg_name, var_name)) { |
| 14 | return ZEND_CALL_VAR_NUM(ed, i); | 15 | return ZEND_CALL_VAR_NUM(ed, i); |
| 15 | } | 16 | } |
| 17 | if (print == true) { | ||
| 18 | sp_log_warn("config", " - %d parameter's name: '%s'", i, arg_name); | ||
| 19 | } | ||
| 16 | } | 20 | } |
| 17 | return NULL; | 21 | return NULL; |
| 18 | } | 22 | } |
| @@ -68,7 +72,7 @@ static zval *get_var_value(zend_execute_data *ed, const char *var_name, | |||
| 68 | } | 72 | } |
| 69 | 73 | ||
| 70 | if (is_param) { | 74 | if (is_param) { |
| 71 | zval *zvalue = get_param_var(ed, var_name); | 75 | zval *zvalue = get_param_var(ed, var_name, false); |
| 72 | if (!zvalue) { | 76 | if (!zvalue) { |
| 73 | char *complete_function_path = get_complete_function_path(ed); | 77 | char *complete_function_path = get_complete_function_path(ed); |
| 74 | sp_log_warn("config", | 78 | sp_log_warn("config", |
| @@ -76,6 +80,7 @@ static zval *get_var_value(zend_execute_data *ed, const char *var_name, | |||
| 76 | "'%s' of the function '%s', but the parameter does " | 80 | "'%s' of the function '%s', but the parameter does " |
| 77 | "not exists.", | 81 | "not exists.", |
| 78 | var_name, complete_function_path); | 82 | var_name, complete_function_path); |
| 83 | get_param_var(ed, var_name, true); | ||
| 79 | efree(complete_function_path); | 84 | efree(complete_function_path); |
| 80 | return NULL; | 85 | return NULL; |
| 81 | } | 86 | } |
