From d6aaabe2773bb8fa1396cae07a7d87e8696e2121 Mon Sep 17 00:00:00 2001 From: Sebastian Thulin Date: Wed, 15 May 2024 13:50:04 +0200 Subject: [PATCH] fix: do not crash when curl is missing. This will effectivly not report any external links. --- source/php/ExternalDetector.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/php/ExternalDetector.php b/source/php/ExternalDetector.php index 99cdfb2..6c53ba7 100644 --- a/source/php/ExternalDetector.php +++ b/source/php/ExternalDetector.php @@ -252,6 +252,13 @@ public function isValidDomainName($domainName) */ public function isDomainAvailable($url, $timeOut = 7) { + if (!function_exists('curl_init')) { + if(defined("BROKEN_LINKS_LOG") && BROKEN_LINKS_LOG) { + error_log("Broken links: Could not probe url " . $url . " due lack of curl in this environment."); + } + return true; + } + // Init curl $ch = curl_init($url); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');