From 4095cad9b4a9825500e2557ba609c10c3a59d632 Mon Sep 17 00:00:00 2001 From: triatic <42704418+triatic@users.noreply.github.com> Date: Wed, 26 Dec 2018 21:31:30 +0000 Subject: [PATCH] lib: Make cURL module requirement optional (#979) When running in CLI mode without certificates, do not require curl module to be loaded. --- lib/Configuration.php | 3 ++- lib/contents.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Configuration.php b/lib/Configuration.php index 3ea98514..9a1e9188 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -95,7 +95,8 @@ final class Configuration { if(!extension_loaded('simplexml')) die('"simplexml" extension not loaded. Please check "php.ini"'); - if(!extension_loaded('curl')) + // Allow RSS-Bridge to run without curl module in CLI mode without root certificates + if(!extension_loaded('curl') && !(php_sapi_name() === 'cli' && empty(ini_get('curl.cainfo')))) die('"curl" extension not loaded. Please check "php.ini"'); if(!extension_loaded('json')) diff --git a/lib/contents.php b/lib/contents.php index 693449a5..9d4ca2fa 100644 --- a/lib/contents.php +++ b/lib/contents.php @@ -53,7 +53,7 @@ function getContents($url, $header = array(), $opts = array()){ $cache->setParameters($params); // Use file_get_contents if in CLI mode with no root certificates defined - if(php_sapi_name() === 'cli' && ini_get('curl.cainfo') === '') { + if(php_sapi_name() === 'cli' && empty(ini_get('curl.cainfo'))) { $data = file_get_contents($url); if($data === false) {