diff --git a/core/config.php b/core/config.php index ca667924..1b030d6f 100644 --- a/core/config.php +++ b/core/config.php @@ -214,7 +214,9 @@ abstract class BaseConfig implements Config public function get_string(string $name, ?string $default=null): ?string { $val = $this->get($name, $default); - if(!is_string($val) && !is_null($val)) throw new SCoreException("$name is not a string: $val"); + if (!is_string($val) && !is_null($val)) { + throw new SCoreException("$name is not a string: $val"); + } return $val; } diff --git a/core/util.php b/core/util.php index cf30650b..4e3c333b 100644 --- a/core/util.php +++ b/core/util.php @@ -208,6 +208,10 @@ function transload(string $url, string $mfile): ?array curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $response = curl_exec($ch); + if ($response === false) { + log_warning("core-util", "Failed to transload $url"); + throw new SCoreException("Failed to fetch $url"); + } $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $headers = http_parse_headers(implode("\n", preg_split('/\R/', rtrim(substr($response, 0, $header_size)))));