|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31612 No error message returned from curl_error() when connection fails by IP.
Submitted: 2005-01-19 17:02 UTC Modified: 2005-02-07 22:37 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: brian dot sanders at cometsystems dot com Assigned:
Status: Not a bug Package: cURL related
PHP Version: 5.0.2 OS: Fedora Core 3
Private report: No CVE-ID: None
 [2005-01-19 17:02 UTC] brian dot sanders at cometsystems dot com
When requesting a file from a bad IP (in this case, with no Web server running) cURL fails to retreive a page (as expected.)  curl_errno() returns an error code of 7, but curl_error returns NULL.

Reproduce code:

$ch = curl_init();
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($ch, CURLOPT_URL, '');
$result = curl_exec($ch);

print('Error code: '.curl_errno($ch)."\n");
print('Error message: '.curl_error($ch)."\n");


Expected result:
Failed to connect (or some such error)

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-31 14:02 UTC] daniel at haxx dot se
This may in fact depend on what error message libcurl reports back, and then this may change depending on what libcurl version you use. There are/were in fact times when libcurl doesn't return an error message (which is considered a bug).

Unless the PHP/curl binding is modified to use the curl_easy_strerror() function.
 [2005-02-07 22:37 UTC]
Likely a bug with old libcurl version.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 19:01:29 2024 UTC