mirror of
https://github.com/processwire/processwire.git
synced 2025-08-19 13:01:26 +02:00
Fix issue processwire/processwire-issues#849
This commit is contained in:
@@ -495,6 +495,7 @@ class WireHttp extends Wire {
|
|||||||
$options = array_merge($defaults, $options);
|
$options = array_merge($defaults, $options);
|
||||||
$url = $this->validateURL($url, false);
|
$url = $this->validateURL($url, false);
|
||||||
$allowFopen = $this->hasFopen;
|
$allowFopen = $this->hasFopen;
|
||||||
|
$allowCURL = $this->hasCURL && version_compare(PHP_VERSION, '5.5') >= 0; // #849
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
||||||
if(empty($url)) return false;
|
if(empty($url)) return false;
|
||||||
@@ -514,6 +515,9 @@ class WireHttp extends Wire {
|
|||||||
if(!$this->hasCURL) {
|
if(!$this->hasCURL) {
|
||||||
$this->error[] = 'CURL is not available';
|
$this->error[] = 'CURL is not available';
|
||||||
return false;
|
return false;
|
||||||
|
} else if(!$allowCURL) {
|
||||||
|
$this->error[] = 'Using CURL requires PHP 5.6+';
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return $this->sendCURL($url, $method, $options);
|
return $this->sendCURL($url, $method, $options);
|
||||||
|
|
||||||
@@ -530,7 +534,7 @@ class WireHttp extends Wire {
|
|||||||
|
|
||||||
if($result === false && $options['fallback'] !== false) {
|
if($result === false && $options['fallback'] !== false) {
|
||||||
// on fopen fail fallback to CURL then sockets
|
// on fopen fail fallback to CURL then sockets
|
||||||
if($this->hasCURL && $options['fallback'] !== 'socket') {
|
if($allowCURL && $options['fallback'] !== 'socket') {
|
||||||
$result = $this->sendCURL($url, $method, $options);
|
$result = $this->sendCURL($url, $method, $options);
|
||||||
}
|
}
|
||||||
if($result === false && $options['fallback'] !== 'curl') {
|
if($result === false && $options['fallback'] !== 'curl') {
|
||||||
|
Reference in New Issue
Block a user