Commit e0fc65dabcc for php
commit e0fc65dabcc638fd7c0d433be00a962540645332
Merge: 931d8ea4e19 f7b9bcc5b57
Author: Weilin Du <weilindu@php.net>
Date: Thu Sep 24 11:57:12 2026 +0800
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
ext/curl: Preserve callback lifetime without rejecting callback changes (#23863)
diff --cc ext/curl/interface.c
index 73088b0c7c9,bcfd44014b6..d1f0cee3d67
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@@ -838,11 -826,9 +854,9 @@@ static size_t curl_read(char *data, siz
} else {
ZVAL_NULL(&argv[1]);
}
- ZVAL_LONG(&argv[2], (int)size * nmemb);
+ ZVAL_LONG(&argv[2], (zend_long) nmemb);
- ch->in_callback = true;
- zend_call_known_fcc(&read_handler->fcc, &retval, /* param_count */ 3, argv, /* named_params */ NULL);
- ch->in_callback = false;
+ php_curl_call_callback(ch, &read_handler->fcc, &retval, /* argc */ 3, argv);
if (!Z_ISUNDEF(retval)) {
_php_curl_verify_handlers(ch, /* reporterror */ true);
if (Z_TYPE(retval) == IS_STRING) {
@@@ -988,32 -914,30 +1000,30 @@@ static int curl_debug(CURL *handle, cur
// as the CURLOPT_DEBUGFUNCTION and stored the debug data when type is set to
// CURLINFO_HEADER_OUT. For backward compatibility, we now store the headers
// but also call the user-callback function if available.
- if (type == CURLINFO_HEADER_OUT) {
- if (ch->header.str) {
- zend_string_release_ex(ch->header.str, 0);
- }
- ch->header.str = zend_string_init(data, size, 0);
- }
+ if (type == CURLINFO_HEADER_OUT) {
+ if (ch->header.str) {
+ zend_string_release_ex(ch->header.str, 0);
+ }
+ ch->header.str = zend_string_init(data, size, 0);
+ }
- if (!ZEND_FCC_INITIALIZED(ch->handlers.debug)) {
- return 0;
- }
+ if (!ZEND_FCC_INITIALIZED(ch->handlers.debug)) {
+ return 0;
+ }
- zval args[3];
+ zval args[3];
- GC_ADDREF(&ch->std);
- ZVAL_OBJ(&args[0], &ch->std);
- ZVAL_LONG(&args[1], type);
- ZVAL_STRINGL(&args[2], data, size);
+ GC_ADDREF(&ch->std);
+ ZVAL_OBJ(&args[0], &ch->std);
+ ZVAL_LONG(&args[1], type);
+ ZVAL_STRINGL(&args[2], data, size);
- ch->in_callback = true;
- zend_call_known_fcc(&ch->handlers.debug, NULL, /* param_count */ 3, args, /* named_params */ NULL);
- ch->in_callback = false;
- php_curl_call_callback(ch, &ch->handlers.debug, NULL, /* argc */ 3, args);
++ php_curl_call_callback(ch, &ch->handlers.debug, NULL, /* argc */ 3, args);
- zval_ptr_dtor(&args[0]);
- zval_ptr_dtor(&args[2]);
+ zval_ptr_dtor(&args[0]);
+ zval_ptr_dtor(&args[2]);
- return 0;
+ return 0;
}
/* }}} */