Handle 'file_get_contents()' failure in 'UrlHelper::fetch()'.

This commit is contained in:
wn_ 2022-08-14 16:52:35 +00:00
parent 57e31fe5a7
commit 830a20debf
1 changed files with 5 additions and 0 deletions

View File

@ -547,6 +547,11 @@ class UrlHelper {
$data = @file_get_contents($url, false, $context); $data = @file_get_contents($url, false, $context);
if ($data === false) {
self::$fetch_last_error = "'file_get_contents' failed.";
return false;
}
foreach ($http_response_header as $header) { foreach ($http_response_header as $header) {
if (strstr($header, ": ") !== false) { if (strstr($header, ": ") !== false) {
list ($key, $value) = explode(": ", $header); list ($key, $value) = explode(": ", $header);