Add check against curl_init failure in runCurl
This commit is contained in:
1 file changed
+3
-1
+3
-1
@@ -184,7 +184,9 @@ public static function strtotime(string $datetime):int {
|
|||||||
*/
|
*/
|
||||||
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);
|
||||||
|
|||||||
Reference in new issue
Block a user