Skip to content

Commit 8412eaf

Browse files
committed
changes from feedback
we do not set curl (function) user handler if there is no actual callback.
1 parent 66646b5 commit 8412eaf

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Zend/zend_API.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -843,12 +843,6 @@ static zend_always_inline void zend_call_known_fcc(
843843
const zend_fcall_info_cache *fcc, zval *retval_ptr, uint32_t param_count, zval *params, HashTable *named_params)
844844
{
845845
zend_function *func = fcc->function_handler;
846-
if (UNEXPECTED(!func)) {
847-
if (retval_ptr) {
848-
ZVAL_UNDEF(retval_ptr);
849-
}
850-
return;
851-
}
852846
/* Need to copy trampolines as they get released after they are called */
853847
if (UNEXPECTED(func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
854848
func = (zend_function*) emalloc(sizeof(zend_function));

ext/curl/interface.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,16 @@ static bool php_curl_set_callable_handler(zend_fcall_info_cache *const handler_f
16341634
#define HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER(curl_ptr, constant_no_function, handler_type) \
16351635
case constant_no_function##FUNCTION: { \
16361636
bool result = php_curl_set_callable_handler(&curl_ptr->handlers.handler_type->fcc, zvalue, is_array_config, #constant_no_function "FUNCTION"); \
1637-
if (!result) { \
1637+
if (!result || (curl_ptr->handlers.handler_type && !curl_ptr->handlers.handler_type->fcc.function_handler)) { \
1638+
if (curl_ptr->handlers.read) { \
1639+
curl_ptr->handlers.read->method = PHP_CURL_STDOUT; \
1640+
} \
1641+
if (curl_ptr->handlers.write) { \
1642+
curl_ptr->handlers.write->method = PHP_CURL_DIRECT; \
1643+
} \
1644+
if (curl_ptr->handlers.write_header) { \
1645+
curl_ptr->handlers.write_header->method = PHP_CURL_IGNORE; \
1646+
} \
16381647
return FAILURE; \
16391648
} \
16401649
curl_ptr->handlers.handler_type->method = PHP_CURL_USER; \

0 commit comments

Comments
 (0)