Skip to content

Commit 810aed1

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Update NEWS with info about curl 8.16 compat fixes Fix curl_setopt_ssl test for curl 8.16 Fix more curl 8.16 issues Fix curl 8.16.0 compilation with zts Fix curl build failure on macOS+curl 8.16
2 parents a30c92c + 742b7d8 commit 810aed1

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.2.30
44

5+
- Curl:
6+
. Fix curl build and test failures with version 8.16.
7+
(nielsdos, ilutov, Jakub Zelenka)
8+
59
- Opcache:
610
. Reset global pointers to prevent use-after-free in zend_jit_status().
711
(Florian Engelhardt)

ext/curl/interface.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -667,11 +667,11 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string)
667667
/* }}} */
668668

669669
/* {{{ curl_progress */
670-
static size_t curl_progress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
670+
static int curl_progress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
671671
{
672672
php_curl *ch = (php_curl *)clientp;
673673
php_curl_callback *t = ch->handlers.progress;
674-
size_t rval = 0;
674+
int rval = 0;
675675

676676
#if PHP_CURL_DEBUG
677677
fprintf(stderr, "curl_progress() called\n");
@@ -1085,8 +1085,8 @@ static void _php_curl_set_default_options(php_curl *ch)
10851085
{
10861086
char *cainfo;
10871087

1088-
curl_easy_setopt(ch->cp, CURLOPT_NOPROGRESS, 1);
1089-
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0);
1088+
curl_easy_setopt(ch->cp, CURLOPT_NOPROGRESS, 1L);
1089+
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0L);
10901090
curl_easy_setopt(ch->cp, CURLOPT_ERRORBUFFER, ch->err.str);
10911091
curl_easy_setopt(ch->cp, CURLOPT_WRITEFUNCTION, curl_write);
10921092
curl_easy_setopt(ch->cp, CURLOPT_FILE, (void *) ch);
@@ -1095,10 +1095,10 @@ static void _php_curl_set_default_options(php_curl *ch)
10951095
curl_easy_setopt(ch->cp, CURLOPT_HEADERFUNCTION, curl_write_header);
10961096
curl_easy_setopt(ch->cp, CURLOPT_WRITEHEADER, (void *) ch);
10971097
#ifndef ZTS
1098-
curl_easy_setopt(ch->cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 1);
1098+
curl_easy_setopt(ch->cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 1L);
10991099
#endif
1100-
curl_easy_setopt(ch->cp, CURLOPT_DNS_CACHE_TIMEOUT, 120);
1101-
curl_easy_setopt(ch->cp, CURLOPT_MAXREDIRS, 20); /* prevent infinite redirects */
1100+
curl_easy_setopt(ch->cp, CURLOPT_DNS_CACHE_TIMEOUT, 120L);
1101+
curl_easy_setopt(ch->cp, CURLOPT_MAXREDIRS, 20L); /* prevent infinite redirects */
11021102

11031103
cainfo = INI_STR("openssl.cafile");
11041104
if (!(cainfo && cainfo[0] != '\0')) {
@@ -1109,7 +1109,7 @@ static void _php_curl_set_default_options(php_curl *ch)
11091109
}
11101110

11111111
#ifdef ZTS
1112-
curl_easy_setopt(ch->cp, CURLOPT_NOSIGNAL, 1);
1112+
curl_easy_setopt(ch->cp, CURLOPT_NOSIGNAL, 1L);
11131113
#endif
11141114
}
11151115
/* }}} */
@@ -1616,7 +1616,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
16161616
lval = zval_get_long(zvalue);
16171617
if (lval == 1) {
16181618
php_error_docref(NULL, E_NOTICE, "CURLOPT_SSL_VERIFYHOST no longer accepts the value 1, value 2 will be used instead");
1619-
error = curl_easy_setopt(ch->cp, option, 2);
1619+
error = curl_easy_setopt(ch->cp, option, 2L);
16201620
break;
16211621
}
16221622
ZEND_FALLTHROUGH;
@@ -2158,7 +2158,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
21582158

21592159
case CURLOPT_FOLLOWLOCATION:
21602160
lval = zend_is_true(zvalue);
2161-
error = curl_easy_setopt(ch->cp, option, lval);
2161+
error = curl_easy_setopt(ch->cp, option, (long) lval);
21622162
break;
21632163

21642164
case CURLOPT_HEADERFUNCTION:
@@ -2176,7 +2176,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
21762176
/* no need to build the mime structure for empty hashtables;
21772177
also works around https://github.com/curl/curl/issues/6455 */
21782178
curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, "");
2179-
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, 0);
2179+
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, 0L);
21802180
} else {
21812181
return build_mime_structure_from_hash(ch, zvalue);
21822182
}
@@ -2255,7 +2255,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
22552255

22562256
case CURLOPT_POSTREDIR:
22572257
lval = zval_get_long(zvalue);
2258-
error = curl_easy_setopt(ch->cp, CURLOPT_POSTREDIR, lval & CURL_REDIR_POST_ALL);
2258+
error = curl_easy_setopt(ch->cp, CURLOPT_POSTREDIR, (long) (lval & CURL_REDIR_POST_ALL));
22592259
break;
22602260

22612261
/* the following options deal with files, therefore the open_basedir check
@@ -2290,11 +2290,11 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
22902290
if (zend_is_true(zvalue)) {
22912291
curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, curl_debug);
22922292
curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, (void *)ch);
2293-
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 1);
2293+
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 1L);
22942294
} else {
22952295
curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, NULL);
22962296
curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, NULL);
2297-
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0);
2297+
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0L);
22982298
}
22992299
break;
23002300

ext/curl/tests/curl_setopt_ssl.phpt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ if ($curl_version['version_number'] < 0x074700) {
1818
--FILE--
1919
<?php
2020

21-
function check_error(CurlHandle $ch) {
21+
function check_error(CurlHandle $ch, $expected = null) {
2222
if (curl_errno($ch) !== 0) {
23-
echo "CURL ERROR: " . curl_errno($ch) . "\n";
23+
$errno = curl_errno($ch);
24+
if (!is_null($expected)) {
25+
$errno = $errno == $expected ? 'EXPECTED' : "UNEXPECTED(A:$errno,E:$expected)";
26+
}
27+
echo "CURL ERROR: " . $errno . "\n";
2428
}
2529
}
2630

@@ -109,7 +113,7 @@ try {
109113

110114
$response = curl_exec($ch);
111115
check_response($response, $clientCertSubject);
112-
check_error($ch);
116+
check_error($ch, curl_version()['version_number'] < 0x081000 ? 58 : 43);
113117
curl_close($ch);
114118

115119
echo "\n";
@@ -203,7 +207,7 @@ bool(true)
203207
bool(true)
204208
bool(true)
205209
client cert subject not in response
206-
CURL ERROR: 58
210+
CURL ERROR: EXPECTED
207211

208212
case 4: client cert and key from file
209213
bool(true)

0 commit comments

Comments
 (0)