Skip to content
Snippets Groups Projects
Commit f82a9668 authored by git's avatar git Committed by Chris Leppanen
Browse files

Issue #2496735 by twistor, diarmy: For PHP 5.6.0 and above, Feeds should allow...

Issue #2496735 by twistor, diarmy: For PHP 5.6.0 and above, Feeds should allow the use of cURL if open_basedir is enabled
parent 9a197f11
No related branches found
No related tags found
No related merge requests found
...@@ -286,7 +286,7 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva ...@@ -286,7 +286,7 @@ function http_request_get($url, $username = NULL, $password = NULL, $accept_inva
* Decides if it's possible to use cURL or not. * Decides if it's possible to use cURL or not.
* *
* @return bool * @return bool
* TRUE if cURL is available, FALSE otherwise. * TRUE if cURL may be used, FALSE otherwise.
*/ */
function http_request_use_curl() { function http_request_use_curl() {
// Allow site administrators to choose to not use cURL. // Allow site administrators to choose to not use cURL.
...@@ -294,9 +294,19 @@ function http_request_use_curl() { ...@@ -294,9 +294,19 @@ function http_request_use_curl() {
return FALSE; return FALSE;
} }
// Check availability of cURL on the system. // Check that the PHP cURL extension has been enabled.
$basedir = ini_get("open_basedir"); if (!extension_loaded('curl')) {
return function_exists('curl_init') && !ini_get('safe_mode') && empty($basedir); return FALSE;
}
// cURL below PHP 5.6.0 must not have open_basedir or safe_mode enabled.
if (version_compare(PHP_VERSION, '5.6.0', '<')) {
return !ini_get('safe_mode') && !ini_get('open_basedir');
}
// cURL in PHP 5.6.0 and above re-enables CURLOPT_FOLLOWLOCATION with
// open_basedir so there is no need to check for this.
return TRUE;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment