mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-12-25 11:22:30 +01:00
142 lines
5.6 KiB
Diff
142 lines
5.6 KiB
Diff
Patch-Source: https://github.com/php/php-src/pull/20093
|
|
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
|
|
index 807b27cb78c90..c56a1b01f2fa1 100644
|
|
--- a/ext/curl/interface.c
|
|
+++ b/ext/curl/interface.c
|
|
@@ -1453,11 +1453,11 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string)
|
|
/* }}} */
|
|
|
|
/* {{{ curl_progress */
|
|
-static size_t curl_progress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
|
|
+static int curl_progress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
|
|
{
|
|
php_curl *ch = (php_curl *)clientp;
|
|
php_curl_callback *t = ch->handlers.progress;
|
|
- size_t rval = 0;
|
|
+ int rval = 0;
|
|
|
|
#if PHP_CURL_DEBUG
|
|
fprintf(stderr, "curl_progress() called\n");
|
|
@@ -1818,8 +1818,8 @@ static void _php_curl_set_default_options(php_curl *ch)
|
|
{
|
|
char *cainfo;
|
|
|
|
- curl_easy_setopt(ch->cp, CURLOPT_NOPROGRESS, 1);
|
|
- curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0);
|
|
+ curl_easy_setopt(ch->cp, CURLOPT_NOPROGRESS, 1L);
|
|
+ curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0L);
|
|
curl_easy_setopt(ch->cp, CURLOPT_ERRORBUFFER, ch->err.str);
|
|
curl_easy_setopt(ch->cp, CURLOPT_WRITEFUNCTION, curl_write);
|
|
curl_easy_setopt(ch->cp, CURLOPT_FILE, (void *) ch);
|
|
@@ -1828,10 +1828,10 @@ static void _php_curl_set_default_options(php_curl *ch)
|
|
curl_easy_setopt(ch->cp, CURLOPT_HEADERFUNCTION, curl_write_header);
|
|
curl_easy_setopt(ch->cp, CURLOPT_WRITEHEADER, (void *) ch);
|
|
#ifndef ZTS
|
|
- curl_easy_setopt(ch->cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 1);
|
|
+ curl_easy_setopt(ch->cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 1L);
|
|
#endif
|
|
- curl_easy_setopt(ch->cp, CURLOPT_DNS_CACHE_TIMEOUT, 120);
|
|
- curl_easy_setopt(ch->cp, CURLOPT_MAXREDIRS, 20); /* prevent infinite redirects */
|
|
+ curl_easy_setopt(ch->cp, CURLOPT_DNS_CACHE_TIMEOUT, 120L);
|
|
+ curl_easy_setopt(ch->cp, CURLOPT_MAXREDIRS, 20L); /* prevent infinite redirects */
|
|
|
|
cainfo = INI_STR("openssl.cafile");
|
|
if (!(cainfo && cainfo[0] != '\0')) {
|
|
@@ -1842,7 +1842,7 @@ static void _php_curl_set_default_options(php_curl *ch)
|
|
}
|
|
|
|
#ifdef ZTS
|
|
- curl_easy_setopt(ch->cp, CURLOPT_NOSIGNAL, 1);
|
|
+ curl_easy_setopt(ch->cp, CURLOPT_NOSIGNAL, 1L);
|
|
#endif
|
|
}
|
|
/* }}} */
|
|
@@ -2289,7 +2289,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue, bool i
|
|
lval = zval_get_long(zvalue);
|
|
if (lval == 1) {
|
|
php_error_docref(NULL, E_NOTICE, "CURLOPT_SSL_VERIFYHOST no longer accepts the value 1, value 2 will be used instead");
|
|
- error = curl_easy_setopt(ch->cp, option, 2);
|
|
+ error = curl_easy_setopt(ch->cp, option, 2L);
|
|
break;
|
|
}
|
|
ZEND_FALLTHROUGH;
|
|
@@ -2789,7 +2789,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue, bool i
|
|
|
|
case CURLOPT_FOLLOWLOCATION:
|
|
lval = zend_is_true(zvalue);
|
|
- error = curl_easy_setopt(ch->cp, option, lval);
|
|
+ error = curl_easy_setopt(ch->cp, option, (long) lval);
|
|
break;
|
|
|
|
case CURLOPT_HEADERFUNCTION:
|
|
@@ -2807,7 +2807,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue, bool i
|
|
/* no need to build the mime structure for empty hashtables;
|
|
also works around https://github.com/curl/curl/issues/6455 */
|
|
curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, "");
|
|
- error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, 0);
|
|
+ error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, 0L);
|
|
} else {
|
|
return build_mime_structure_from_hash(ch, zvalue);
|
|
}
|
|
@@ -2871,7 +2871,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue, bool i
|
|
|
|
case CURLOPT_POSTREDIR:
|
|
lval = zval_get_long(zvalue);
|
|
- error = curl_easy_setopt(ch->cp, CURLOPT_POSTREDIR, lval & CURL_REDIR_POST_ALL);
|
|
+ error = curl_easy_setopt(ch->cp, CURLOPT_POSTREDIR, (long) (lval & CURL_REDIR_POST_ALL));
|
|
break;
|
|
|
|
/* the following options deal with files, therefore the open_basedir check
|
|
@@ -2906,11 +2906,11 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue, bool i
|
|
if (zend_is_true(zvalue)) {
|
|
curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, curl_debug);
|
|
curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, (void *)ch);
|
|
- curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 1);
|
|
+ curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 1L);
|
|
} else {
|
|
curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, NULL);
|
|
curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, NULL);
|
|
- curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0);
|
|
+ curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0L);
|
|
}
|
|
break;
|
|
|
|
diff --git a/ext/curl/tests/curl_setopt_ssl.phpt b/ext/curl/tests/curl_setopt_ssl.phpt
|
|
index 11d8fff702a88..ff08528321a0f 100644
|
|
--- a/ext/curl/tests/curl_setopt_ssl.phpt
|
|
+++ b/ext/curl/tests/curl_setopt_ssl.phpt
|
|
@@ -18,9 +18,13 @@ if ($curl_version['version_number'] < 0x074700) {
|
|
--FILE--
|
|
<?php
|
|
|
|
-function check_error(CurlHandle $ch) {
|
|
+function check_error(CurlHandle $ch, $expected = null) {
|
|
if (curl_errno($ch) !== 0) {
|
|
- echo "CURL ERROR: " . curl_errno($ch) . "\n";
|
|
+ $errno = curl_errno($ch);
|
|
+ if (!is_null($expected)) {
|
|
+ $errno = $errno == $expected ? 'EXPECTED' : "UNEXPECTED(A:$errno,E:$expected)";
|
|
+ }
|
|
+ echo "CURL ERROR: " . $errno . "\n";
|
|
}
|
|
}
|
|
|
|
@@ -109,7 +113,7 @@ try {
|
|
|
|
$response = curl_exec($ch);
|
|
check_response($response, $clientCertSubject);
|
|
- check_error($ch);
|
|
+ check_error($ch, curl_version()['version_number'] < 0x081000 ? 58 : 43);
|
|
curl_close($ch);
|
|
|
|
echo "\n";
|
|
@@ -203,7 +207,7 @@ bool(true)
|
|
bool(true)
|
|
bool(true)
|
|
client cert subject not in response
|
|
-CURL ERROR: 58
|
|
+CURL ERROR: EXPECTED
|
|
|
|
case 4: client cert and key from file
|
|
bool(true)
|