Bug #68566 [NEW]: Operation timeouts contain misleading error description
From: marcus at synchromedia dot co dot uk
Operating system:
PHP version: 5.6.3
Package: HTTP related
Bug Type: Bug
Bug description:Operation timeouts contain misleading error description
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
--
Edit bug report at https://bugs.php.net/bug.php?id=68566&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68566&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68566&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68566&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68566&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68566&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68566&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68566&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68566&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68566&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68566&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68566&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68566&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68566&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68566&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68566&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68566&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68566&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68566&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68566&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68566&r=mysqlcfg
Thread (6 messages)
- marcus at synchromedia dot co dot uk