From e37882011f90fae035f20e214bf3b24b0868cf9a Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 29 Jan 2023 10:30:56 -0500 Subject: [PATCH] Add support for local files for unsecured document loading - $http_response_header isn't set in the local file read case --- jsonld.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsonld.php b/jsonld.php index 28361af..34b3df3 100644 --- a/jsonld.php +++ b/jsonld.php @@ -346,7 +346,7 @@ function jsonld_get_url($url) /** * The default implementation to retrieve JSON-LD at the given URL. * - * @param string $url the URL to to retrieve. + * @param string $url The document URL or a local path * * @return stdClass the RemoteDocument object. */ @@ -388,7 +388,7 @@ function jsonld_default_document_loader($url) } $link_header = []; - foreach ($http_response_header as $header) { + foreach ($http_response_header ?? [] as $header) { if (strpos($header, 'link') === 0) { $value = explode(': ', $header); if (count($value) > 1) {