From f5a51038cc1037c0b9e44476ea56a633cc39020b Mon Sep 17 00:00:00 2001 From: Dag Date: Sun, 8 May 2022 04:42:24 +0200 Subject: [PATCH] fix: error when passing null values This bug was introduced by me when refactoring the http client. Fixes: Fatal error: Uncaught TypeError: Argument 2 passed to getContents() must be of the type array, null given --- lib/contents.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/contents.php b/lib/contents.php index 2910b47e..903f65e7 100644 --- a/lib/contents.php +++ b/lib/contents.php @@ -252,7 +252,11 @@ function getSimpleHTMLDOMCached($url, && !Debug::isEnabled()) { // Contents within duration $content = $cache->loadData(); } else { // Content not within duration - $content = getContents($url, $header, $opts); + $content = getContents( + $url, + $header ?? [], + $opts ?? [] + ); if($content !== false) { $cache->saveData($content); }