php.net |  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
Votes:1
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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: brian dot sanders at cometsystems dot com
New email:
PHP Version: OS:

 

 [2005-01-19 17:02 UTC] brian dot sanders at cometsystems dot com
Description:
------------
When requesting a file from a bad IP (in this case 127.0.0.1, 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:
---------------
<?php

$ch = curl_init();
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1');
$result = curl_exec($ch);

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

 ?>


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

Actual result:
--------------
7

Patches

Pull Requests

History

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] iliaa@php.net
Likely a bug with old libcurl version.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 08 15:01:28 2024 UTC