Add check against curl_init failure in runCurl

This commit is contained in:
Joshua Ramon Enslin 2020-12-08 11:36:54 +01:00
parent ada82f07b6
commit ddab52b1a5
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -184,7 +184,9 @@ final class MD_STD {
*/ */
public static function runCurl(string $url, int $timeout = 1200):string { 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_URL, $url);
\curl_setopt($curl, CURLOPT_HEADER, false); \curl_setopt($curl, CURLOPT_HEADER, false);