diff options
| author | Christian Göttsche | 2024-05-27 22:40:33 +0200 |
|---|---|---|
| committer | jvoisin | 2024-06-09 17:16:23 +0200 |
| commit | ea08ba005b7a3a3de379fec3c173fa9c21d81fa7 (patch) | |
| tree | 9fcde7dff2349ea4a9206b343b8b92da4d4c0ac1 /src | |
| parent | 23c7b5a030d3662274053c26d755ea23fe342c99 (diff) | |
Ensure to inject php-stream filter also on stream_wrapper_restore()
Not sure this is needed, but better safe than sorry.
Diffstat (limited to '')
| -rw-r--r-- | src/sp_wrapper.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/sp_wrapper.c b/src/sp_wrapper.c index 54a3a7a..174c967 100644 --- a/src/sp_wrapper.c +++ b/src/sp_wrapper.c | |||
| @@ -188,12 +188,30 @@ PHP_FUNCTION(sp_stream_wrapper_register) { | |||
| 188 | } | 188 | } |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | PHP_FUNCTION(sp_stream_wrapper_restore) { | ||
| 192 | zif_handler orig_handler; | ||
| 193 | zend_string *protocol_name = NULL; | ||
| 194 | zval *params = NULL; | ||
| 195 | uint32_t param_count = 0; | ||
| 196 | |||
| 197 | zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "S*", &protocol_name, ¶ms, ¶m_count); | ||
| 198 | orig_handler = zend_hash_str_find_ptr(SPG(sp_internal_functions_hook), ZEND_STRL("stream_wrapper_restore")); | ||
| 199 | orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); | ||
| 200 | |||
| 201 | if (protocol_name && !strcasecmp(ZSTR_VAL(protocol_name), "php")) { | ||
| 202 | sp_reregister_php_wrapper(); | ||
| 203 | } | ||
| 204 | } | ||
| 205 | |||
| 191 | int hook_stream_wrappers() { | 206 | int hook_stream_wrappers() { |
| 192 | TSRMLS_FETCH(); | 207 | TSRMLS_FETCH(); |
| 193 | 208 | ||
| 194 | HOOK_FUNCTION("stream_wrapper_register", sp_internal_functions_hook, | 209 | HOOK_FUNCTION("stream_wrapper_register", sp_internal_functions_hook, |
| 195 | PHP_FN(sp_stream_wrapper_register)); | 210 | PHP_FN(sp_stream_wrapper_register)); |
| 196 | 211 | ||
| 212 | HOOK_FUNCTION("stream_wrapper_restore", sp_internal_functions_hook, | ||
| 213 | PHP_FN(sp_stream_wrapper_restore)); | ||
| 214 | |||
| 197 | sp_reregister_php_wrapper(); | 215 | sp_reregister_php_wrapper(); |
| 198 | 216 | ||
| 199 | return SUCCESS; | 217 | return SUCCESS; |
