|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45701 curl_setopt and CURLOPT_URL detecting wrong username, password, and host..
Submitted: 2008-08-03 14:30 UTC Modified: 2008-08-03 16:20 UTC
From: sergiocrz at hotmail dot com Assigned:
Status: Not a bug Package: cURL related
PHP Version: 5.2.6 OS: XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: sergiocrz at hotmail dot com
New email:
PHP Version: OS:


 [2008-08-03 14:30 UTC] sergiocrz at hotmail dot com
curl_setopt($ch, CURLOPT_URL, "ftp://$ftp_user_name:$ftp_pass@$ftp_ip:$ftp_port$path/");

PHP CURL will connect to the wrong ftp ip/host if the username or password contains an "@" and there is no way to force it using the correct values.

Reproduce code:
$ftp_user_name = "jo@na";
$ftp_pass "bujona"; 
$ftp_ip = "";
$ftp_port = "21";
$path = "";

curl_setopt($ch, CURLOPT_URL, "ftp://$ftp_user_name:$ftp_pass@$ftp_ip:$ftp_port$path/");

Expected result:
PHP CURL connecting to "ftp://jo@na:bujona@"

Actual result:
PHP CURL uses "na:bujona@" as ip/hostname

Is there any way to solve this bug?

thank you


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-03 14:41 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

See Bug#44456, thanks.
 [2008-08-03 16:20 UTC]
It's expected. Please don't reopen again.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Jul 26 06:01:23 2021 UTC