New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
curl error msg for low version #2108
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,8 @@ | |
*/ | ||
class CurlFactory implements CurlFactoryInterface | ||
{ | ||
private const CURL_VERSION_STR = 'curl_version'; | ||
private const LOW_CURL_VERSION_NUMBER = '7.21.2'; | ||
/** @var array */ | ||
private $handles = []; | ||
|
||
|
@@ -137,6 +139,7 @@ private static function finishError( | |
'errno' => $easy->errno, | ||
'error' => curl_error($easy->handle), | ||
] + curl_getinfo($easy->handle); | ||
$ctx[self::CURL_VERSION_STR] = curl_version()['version']; | ||
$factory->release($easy); | ||
|
||
// Retry when nothing is present or when curl failed to rewind. | ||
|
@@ -172,13 +175,22 @@ private static function createRejection(EasyHandle $easy, array $ctx) | |
) | ||
); | ||
} | ||
|
||
$message = sprintf( | ||
'cURL error %s: %s (%s)', | ||
$ctx['errno'], | ||
$ctx['error'], | ||
'see https://curl.haxx.se/libcurl/c/libcurl-errors.html' | ||
); | ||
if (version_compare($ctx[self::CURL_VERSION_STR], self::LOW_CURL_VERSION_NUMBER)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry to be late but this seems wrong, it's missing a comparison operator (either against 0 or as a third string argument, see examples). Currently it's basically testing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. proposed #2648 |
||
$message = sprintf( | ||
'cURL error %s: %s (%s)', | ||
$ctx['errno'], | ||
$ctx['error'], | ||
'see https://curl.haxx.se/libcurl/c/libcurl-errors.html' | ||
); | ||
} else { | ||
$message = sprintf( | ||
'cURL error %s: %s (%s) for %s', | ||
$ctx['errno'], | ||
$ctx['error'], | ||
'see https://curl.haxx.se/libcurl/c/libcurl-errors.html', | ||
$easy->request->getUri() | ||
); | ||
} | ||
|
||
// Create a connection exception if it was a specific error code. | ||
$error = isset($connectionErrors[$easy->errno]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constant visibility is not supported on PHP 5.x