mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.4'
This commit is contained in:
commit
2e263d26a2
2 changed files with 25 additions and 4 deletions
|
@ -1629,12 +1629,17 @@ static bool php_curl_set_callable_handler(zend_fcall_info_cache *const handler_f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER(curl_ptr, constant_no_function, handler_type) \
|
#define HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER(curl_ptr, constant_no_function, handler_type, default_method) \
|
||||||
case constant_no_function##FUNCTION: { \
|
case constant_no_function##FUNCTION: { \
|
||||||
bool result = php_curl_set_callable_handler(&curl_ptr->handlers.handler_type->fcc, zvalue, is_array_config, #constant_no_function "FUNCTION"); \
|
bool result = php_curl_set_callable_handler(&curl_ptr->handlers.handler_type->fcc, zvalue, is_array_config, #constant_no_function "FUNCTION"); \
|
||||||
if (!result) { \
|
if (!result) { \
|
||||||
|
curl_ptr->handlers.handler_type->method = default_method; \
|
||||||
return FAILURE; \
|
return FAILURE; \
|
||||||
} \
|
} \
|
||||||
|
if (!ZEND_FCC_INITIALIZED(curl_ptr->handlers.handler_type->fcc)) { \
|
||||||
|
curl_ptr->handlers.handler_type->method = default_method; \
|
||||||
|
return SUCCESS; \
|
||||||
|
} \
|
||||||
curl_ptr->handlers.handler_type->method = PHP_CURL_USER; \
|
curl_ptr->handlers.handler_type->method = PHP_CURL_USER; \
|
||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
|
@ -1657,9 +1662,9 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
|
||||||
|
|
||||||
switch (option) {
|
switch (option) {
|
||||||
/* Callable options */
|
/* Callable options */
|
||||||
HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER(ch, CURLOPT_WRITE, write);
|
HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER(ch, CURLOPT_WRITE, write, PHP_CURL_STDOUT);
|
||||||
HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER(ch, CURLOPT_HEADER, write_header);
|
HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER(ch, CURLOPT_HEADER, write_header, PHP_CURL_IGNORE);
|
||||||
HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER(ch, CURLOPT_READ, read);
|
HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER(ch, CURLOPT_READ, read, PHP_CURL_DIRECT);
|
||||||
|
|
||||||
HANDLE_CURL_OPTION_CALLABLE(ch, CURLOPT_PROGRESS, handlers.progress, curl_progress);
|
HANDLE_CURL_OPTION_CALLABLE(ch, CURLOPT_PROGRESS, handlers.progress, curl_progress);
|
||||||
HANDLE_CURL_OPTION_CALLABLE(ch, CURLOPT_XFERINFO, handlers.xferinfo, curl_xferinfo);
|
HANDLE_CURL_OPTION_CALLABLE(ch, CURLOPT_XFERINFO, handlers.xferinfo, curl_xferinfo);
|
||||||
|
|
16
ext/curl/tests/gh16359.phpt
Normal file
16
ext/curl/tests/gh16359.phpt
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
--TEST--
|
||||||
|
GH-16359 - curl_setopt with CURLOPT_WRITEFUNCTION and no user fn
|
||||||
|
--EXTENSIONS--
|
||||||
|
curl
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$log_file = tempnam(sys_get_temp_dir(), 'php-curl-CURLOPT_WRITEFUNCTION-trampoline');
|
||||||
|
$fp = fopen($log_file, 'w+');
|
||||||
|
fwrite($fp, "test");
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_WRITEFUNCTION, null);
|
||||||
|
curl_setopt($ch, CURLOPT_URL, 'file://' . $log_file);
|
||||||
|
curl_exec($ch);
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
test
|
Loading…
Add table
Add a link
Reference in a new issue