Skip to content

Commit

Permalink
fix: do not crash when curl is missing.
Browse files Browse the repository at this point in the history
This will effectivly not report any external links.
  • Loading branch information
Sebastian Thulin committed May 15, 2024
1 parent 12eba0c commit d6aaabe
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions source/php/ExternalDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit d6aaabe

Please sign in to comment.