From ddab52b1a50c004141a35631f871fde136bcaff9 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Tue, 8 Dec 2020 11:36:54 +0100 Subject: [PATCH] Add check against curl_init failure in runCurl --- MD_STD.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MD_STD.php b/MD_STD.php index b9e1578..9ac9b01 100644 --- a/MD_STD.php +++ b/MD_STD.php @@ -184,7 +184,9 @@ final class MD_STD { */ public static function runCurl(string $url, int $timeout = 1200):string { - $curl = \curl_init(); + if (($curl = \curl_init()) === false) { + throw new MDExpectedException("Curl initialization failed."); + } \curl_setopt($curl, CURLOPT_URL, $url); \curl_setopt($curl, CURLOPT_HEADER, false);