@@ -1629,12 +1629,17 @@ static bool php_curl_set_callable_handler(zend_fcall_info_cache *const handler_f
1629
1629
}
1630
1630
1631
1631
1632
- #define HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER (curl_ptr , constant_no_function , handler_type ) \
1632
+ #define HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER (curl_ptr , constant_no_function , handler_type , default_method ) \
1633
1633
case constant_no_function##FUNCTION: { \
1634
1634
bool result = php_curl_set_callable_handler(&curl_ptr->handlers.handler_type->fcc, zvalue, is_array_config, #constant_no_function "FUNCTION"); \
1635
1635
if (!result) { \
1636
+ curl_ptr->handlers.handler_type->method = default_method; \
1636
1637
return FAILURE; \
1637
1638
} \
1639
+ if (!ZEND_FCC_INITIALIZED(curl_ptr->handlers.handler_type->fcc)) { \
1640
+ curl_ptr->handlers.handler_type->method = default_method; \
1641
+ return SUCCESS; \
1642
+ } \
1638
1643
curl_ptr->handlers.handler_type->method = PHP_CURL_USER; \
1639
1644
break; \
1640
1645
}
@@ -1657,9 +1662,9 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
1657
1662
1658
1663
switch (option ) {
1659
1664
/* Callable options */
1660
- HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER (ch , CURLOPT_WRITE , write );
1661
- HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER (ch , CURLOPT_HEADER , write_header );
1662
- HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER (ch , CURLOPT_READ , read );
1665
+ HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER (ch , CURLOPT_WRITE , write , PHP_CURL_STDOUT );
1666
+ HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER (ch , CURLOPT_HEADER , write_header , PHP_CURL_IGNORE );
1667
+ HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER (ch , CURLOPT_READ , read , PHP_CURL_DIRECT );
1663
1668
1664
1669
HANDLE_CURL_OPTION_CALLABLE (ch , CURLOPT_PROGRESS , handlers .progress , curl_progress );
1665
1670
HANDLE_CURL_OPTION_CALLABLE (ch , CURLOPT_XFERINFO , handlers .xferinfo , curl_xferinfo );
0 commit comments