Avoid using curl when it has been disabled, fixes #9423

main
Jordi Boggiano 4 years ago
parent 4b8e77b2da
commit 3f6899946b
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -379,7 +379,11 @@ EOT
private function getCurlVersion() private function getCurlVersion()
{ {
if (function_exists('curl_version')) { if (extension_loaded('curl')) {
if (!HttpDownloader::isCurlEnabled()) {
return '<error>disabled via disable_functions, using php streams fallback, which reduces performance</error>';
}
$version = curl_version(); $version = curl_version();
return '<comment>'.$version['version'].'</comment> '. return '<comment>'.$version['version'].'</comment> '.

@ -67,8 +67,7 @@ class HttpDownloader
$this->options = array_replace_recursive($this->options, $options); $this->options = array_replace_recursive($this->options, $options);
$this->config = $config; $this->config = $config;
// TODO enable curl only on 5.6+ if older versions cause any problem if (self::isCurlEnabled()) {
if (extension_loaded('curl')) {
$this->curl = new Http\CurlDownloader($io, $config, $options, $disableTls); $this->curl = new Http\CurlDownloader($io, $config, $options, $disableTls);
} }
@ -423,4 +422,9 @@ class HttpDownloader
return true; return true;
} }
public static function isCurlEnabled()
{
return \extension_loaded('curl') && \function_exists('curl_multi_exec') && \function_exists('curl_multi_init');
}
} }

Loading…
Cancel
Save