php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68566 Operation timeouts contain misleading error description
Submitted: 2014-12-08 12:08 UTC Modified: 2016-08-17 09:40 UTC
Votes:3
Avg. Score:4.3 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: marcus at synchromedia dot co dot uk Assigned: mike (profile)
Status: Closed Package: HTTP related
PHP Version: 5.6.3 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: marcus at synchromedia dot co dot uk
New email:
PHP Version: OS:

 

 [2014-12-08 12:08 UTC] marcus at synchromedia dot co dot uk
Description:
------------
Just a little thing! If you request a URL that takes longer than the allowed time to respond (as set in client options), the response correctly sets a CURL error code of 28 (http://curl.haxx.se/libcurl/c/libcurl-errors.html; CURLE_OPERATION_TIMEDOUT), but the text of the error is "Resolving timed out after <x> milliseconds". This is misleading because it's not the resolving that is timing out, but the request.

I suppose you could argue that you can apply the term 'resolving' to the fetching of a URL, but it would be unusual as that term is usually reserved for DNS lookups.

For a DNS resolution error, the curlerror would be 6 - an example error for that is:

6: Could not resolve host: <host name>

Test script:
---------------
Test target:

<?php
sleep(5);
echo 'ok';

Test script:
<?php
$request = new http\Client\Request("GET",
	"http://localhost/slow.php"
);
$request->setOptions(["timeout" => 1]);

$client = new http\Client;
try {
	$client->enqueue($request)->send();
} catch (Exception $e) {
	$response = $client->getResponse();
	$t = $response->getTransferInfo();
	echo $t->curlcode . ': ' . $t->error;
}


Expected result:
----------------
28: Operation timed out after 1000 milliseconds

Actual result:
--------------
28: Resolving timed out after 1000 milliseconds

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-08 12:10 UTC] marcus at synchromedia dot co dot uk
Note that this resport is against pecl_http 2.1.4, not the old 1.x version covered by PHP docs.
 [2014-12-09 17:15 UTC] mike@php.net
-Status: Open +Status: Not a bug
 [2014-12-09 17:15 UTC] mike@php.net
Actually, both of this fields are filled by libcurl.

"Could not resolve host" would be thrown for a DNS lookup *failure*, but you actually timed out *while* resolving the host name.
 [2014-12-09 21:43 UTC] mike@php.net
-Status: Not a bug +Status: Re-Opened
 [2014-12-09 21:43 UTC] mike@php.net
Oh well, should have read the reproducer.
 [2016-05-13 10:20 UTC] joe dot afflerbach+phpnet at sevenval dot com
Works for me with PHP 7.0.6 and pecl HTTP 3.0.1 linked against curl 7.42.1.
 [2016-08-17 09:40 UTC] mike@php.net
-Status: Re-Opened +Status: Closed -Assigned To: +Assigned To: mike
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 21:01:27 2025 UTC