diff options
| author | Ben Fuhrmannek | 2021-11-30 19:35:40 +0100 |
|---|---|---|
| committer | Ben Fuhrmannek | 2021-11-30 19:35:40 +0100 |
| commit | 49bc961d012c26ea7a26e6a3a2a6a989a8870a99 (patch) | |
| tree | 164d9fb52eef9e0843604de950ce0ded6927811f /src/sp_wrapper.c | |
| parent | aa099cd7a4aa5e3296d39158184e301af9ef2f78 (diff) | |
fixed crash when parsing arguments with PHP 8.1
Diffstat (limited to 'src/sp_wrapper.c')
| -rw-r--r-- | src/sp_wrapper.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/sp_wrapper.c b/src/sp_wrapper.c index 1538e33..9eb5cbc 100644 --- a/src/sp_wrapper.c +++ b/src/sp_wrapper.c | |||
| @@ -44,14 +44,12 @@ void sp_disable_wrapper() { | |||
| 44 | PHP_FUNCTION(sp_stream_wrapper_register) { | 44 | PHP_FUNCTION(sp_stream_wrapper_register) { |
| 45 | zif_handler orig_handler; | 45 | zif_handler orig_handler; |
| 46 | zend_string *protocol_name = NULL; | 46 | zend_string *protocol_name = NULL; |
| 47 | zval *params = NULL; | ||
| 48 | uint32_t param_count = 0; | ||
| 47 | 49 | ||
| 48 | // LCOV_EXCL_BR_START | 50 | zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "S*", &protocol_name, ¶ms, ¶m_count); |
| 49 | ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_QUIET, 2, EX_NUM_ARGS()); | 51 | // ignore proper arguments here and just let the original handler deal with it |
| 50 | Z_PARAM_STR(protocol_name); | 52 | if (!protocol_name || wrapper_is_whitelisted(protocol_name)) { |
| 51 | ZEND_PARSE_PARAMETERS_END_EX((void)0); | ||
| 52 | // LCOV_EXCL_BR_END | ||
| 53 | |||
| 54 | if (wrapper_is_whitelisted(protocol_name)) { | ||
| 55 | orig_handler = zend_hash_str_find_ptr(SPG(sp_internal_functions_hook), ZEND_STRL("stream_wrapper_register")); | 53 | orig_handler = zend_hash_str_find_ptr(SPG(sp_internal_functions_hook), ZEND_STRL("stream_wrapper_register")); |
| 56 | orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); | 54 | orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); |
| 57 | } | 55 | } |
