Skip to content

Commit bf9c881

Browse files
committed
add CURLOPT_USERNAME case
1 parent 9030bb0 commit bf9c881

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

ext/curl/interface.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,6 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
19061906
case CURLOPT_PASSWORD:
19071907
case CURLOPT_PROXYPASSWORD:
19081908
case CURLOPT_PROXYUSERNAME:
1909-
case CURLOPT_USERNAME:
19101909
case CURLOPT_NOPROXY:
19111910
case CURLOPT_SOCKS5_GSSAPI_SERVICE:
19121911
case CURLOPT_MAIL_FROM:
@@ -1998,6 +1997,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
19981997
}
19991998

20001999
case CURLOPT_USERPWD:
2000+
case CURLOPT_USERNAME:
20012001
{
20022002
if (Z_ISNULL_P(zvalue)) {
20032003
// Authorization header would be implictly set

ext/curl/tests/gh18458.phpt

+8
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@ curl_setopt($ch, CURLOPT_VERBOSE, true);
1515
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1616
$response = curl_exec($ch);
1717
var_dump(str_contains($response, "authorization"));
18+
$ch = curl_init("https://localhost/username");
19+
curl_setopt($ch, CURLOPT_USERNAME, null);
20+
curl_setopt($ch, CURLOPT_VERBOSE, true);
21+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
22+
$response = curl_exec($ch);
23+
var_dump(str_contains($response, "authorization"));
1824
?>
1925
--EXPECT--
2026
%A
2127
bool(false)
28+
%A
29+
bool(false)

0 commit comments

Comments
 (0)