diff options
Diffstat (limited to 'src/sp_execute.c')
| -rw-r--r-- | src/sp_execute.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/sp_execute.c b/src/sp_execute.c index 21a68dd..aadd145 100644 --- a/src/sp_execute.c +++ b/src/sp_execute.c | |||
| @@ -161,14 +161,18 @@ static inline void sp_execute_handler(INTERNAL_FUNCTION_PARAMETERS, bool interna | |||
| 161 | return; | 161 | return; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | const sp_list_node *config_disabled_functions_reg = SPCFG(disabled_functions_reg).disabled_functions; | 164 | bool is_hooked = (zend_hash_str_find(SPG(disabled_functions_hook), VAR_AND_LEN(function_name)) || zend_hash_str_find(SPG(disabled_functions_hook), VAR_AND_LEN(function_name))); |
| 165 | if (is_hooked) { | ||
| 166 | sp_call_orig_execute(INTERNAL_FUNCTION_PARAM_PASSTHRU, internal); | ||
| 167 | return; | ||
| 168 | } | ||
| 165 | 169 | ||
| 166 | // If we're at an internal function | 170 | // If we're at an internal function |
| 167 | if (!execute_data->prev_execute_data || | 171 | if (!execute_data->prev_execute_data || |
| 168 | !execute_data->prev_execute_data->func || | 172 | !execute_data->prev_execute_data->func || |
| 169 | !ZEND_USER_CODE(execute_data->prev_execute_data->func->type) || | 173 | !ZEND_USER_CODE(execute_data->prev_execute_data->func->type) || |
| 170 | !execute_data->prev_execute_data->opline) { | 174 | !execute_data->prev_execute_data->opline) { |
| 171 | should_disable_ht(execute_data, function_name, NULL, NULL, config_disabled_functions_reg, SPCFG(disabled_functions)); | 175 | should_disable_ht(execute_data, function_name, NULL, NULL, SPCFG(disabled_functions_reg).disabled_functions, SPCFG(disabled_functions)); |
| 172 | } else { // If we're at a userland function call | 176 | } else { // If we're at a userland function call |
| 173 | switch (execute_data->prev_execute_data->opline->opcode) { | 177 | switch (execute_data->prev_execute_data->opline->opcode) { |
| 174 | case ZEND_DO_FCALL: | 178 | case ZEND_DO_FCALL: |
| @@ -176,7 +180,7 @@ static inline void sp_execute_handler(INTERNAL_FUNCTION_PARAMETERS, bool interna | |||
| 176 | case ZEND_DO_ICALL: | 180 | case ZEND_DO_ICALL: |
| 177 | case ZEND_DO_UCALL: | 181 | case ZEND_DO_UCALL: |
| 178 | case ZEND_TICKS: | 182 | case ZEND_TICKS: |
| 179 | should_disable_ht(execute_data, function_name, NULL, NULL, config_disabled_functions_reg, SPCFG(disabled_functions)); | 183 | should_disable_ht(execute_data, function_name, NULL, NULL, SPCFG(disabled_functions_reg).disabled_functions, SPCFG(disabled_functions)); |
| 180 | default: | 184 | default: |
| 181 | break; | 185 | break; |
| 182 | } | 186 | } |
| @@ -188,23 +192,24 @@ static inline void sp_execute_handler(INTERNAL_FUNCTION_PARAMETERS, bool interna | |||
| 188 | zval ret_val; | 192 | zval ret_val; |
| 189 | if (EX(return_value) == NULL) { | 193 | if (EX(return_value) == NULL) { |
| 190 | memset(&ret_val, 0, sizeof(ret_val)); | 194 | memset(&ret_val, 0, sizeof(ret_val)); |
| 191 | EX(return_value) = &ret_val; | 195 | return_value = EX(return_value) = &ret_val; |
| 192 | } | 196 | } |
| 193 | 197 | ||
| 194 | sp_call_orig_execute(INTERNAL_FUNCTION_PARAM_PASSTHRU, internal); | 198 | sp_call_orig_execute(INTERNAL_FUNCTION_PARAM_PASSTHRU, internal); |
| 195 | 199 | ||
| 196 | should_drop_on_ret_ht(EX(return_value), function_name, SPCFG(disabled_functions_reg_ret).disabled_functions, SPCFG(disabled_functions_ret), execute_data); | 200 | should_drop_on_ret_ht(return_value, function_name, SPCFG(disabled_functions_reg_ret).disabled_functions, SPCFG(disabled_functions_ret), execute_data); |
| 201 | |||
| 197 | efree(function_name); | 202 | efree(function_name); |
| 198 | 203 | ||
| 199 | if (EX(return_value) == &ret_val) { | 204 | if (EX(return_value) == &ret_val) { |
| 200 | EX(return_value) = NULL; | 205 | return_value = EX(return_value) = NULL; |
| 201 | } | 206 | } |
| 202 | 207 | ||
| 203 | } | 208 | } |
| 204 | 209 | ||
| 205 | 210 | ||
| 206 | static void sp_execute_ex(zend_execute_data *execute_data) { | 211 | static void sp_execute_ex(zend_execute_data *execute_data) { |
| 207 | sp_execute_handler(execute_data, NULL, false); | 212 | sp_execute_handler(execute_data, execute_data ? EX(return_value) : NULL, false); |
| 208 | } | 213 | } |
| 209 | 214 | ||
| 210 | static void sp_zend_execute_internal(INTERNAL_FUNCTION_PARAMETERS) { | 215 | static void sp_zend_execute_internal(INTERNAL_FUNCTION_PARAMETERS) { |
