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
This commit is contained in:
Dag 2022-05-08 04:42:24 +02:00
parent 3476b06ee0
commit f5a51038cc
1 changed files with 5 additions and 1 deletions

View File

@ -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);
}