From 7ac76639c5d0fc5f738608e7bf2ccff420b2714c Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 22 Sep 2021 02:41:24 +0000 Subject: [PATCH 1/2] AVoid warning when fetching page data --- src/Util/ParseUrl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Util/ParseUrl.php b/src/Util/ParseUrl.php index 391b96767e..d40a0a4e91 100644 --- a/src/Util/ParseUrl.php +++ b/src/Util/ParseUrl.php @@ -1116,7 +1116,7 @@ class ParseUrl } $content = JsonLD::fetchElement($jsonld, 'image', 'url', '@type', 'ImageObject'); - if (!empty($content)) { + if (!empty($content) && is_string($content)) { $jsonldinfo['author_img'] = trim($content); } From 840d9823d4b9dda0053a6a97fa203a0154ba156d Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 22 Sep 2021 03:25:01 +0000 Subject: [PATCH 2/2] Log unexpected value --- src/Util/ParseUrl.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Util/ParseUrl.php b/src/Util/ParseUrl.php index d40a0a4e91..5891649525 100644 --- a/src/Util/ParseUrl.php +++ b/src/Util/ParseUrl.php @@ -1116,6 +1116,10 @@ class ParseUrl } $content = JsonLD::fetchElement($jsonld, 'image', 'url', '@type', 'ImageObject'); + if (!empty($content) && !is_string($content)) { + Logger::notice('Unexpected return value for the author image', ['content' => $content]); + } + if (!empty($content) && is_string($content)) { $jsonldinfo['author_img'] = trim($content); }