forked from leftypol/leftypol
functions.php: handle bad json from iphub
This commit is contained in:
parent
f1bbd09751
commit
155a6eae84
1 changed files with 11 additions and 0 deletions
|
@ -1881,6 +1881,17 @@ function checkIPAPI(string $ip): bool {
|
|||
}
|
||||
|
||||
$json = json_decode($reply);
|
||||
if ($json === null) {
|
||||
error_log('IPHub query failed: api returned incorrect json');
|
||||
|
||||
if ($config['cache']['enabled']) {
|
||||
// Store the result for 4 hours.
|
||||
cache::set("ip_api_block_$ip", 'api_error', 14400);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($json->error)) {
|
||||
error_log("IPHub query failed: $json->error");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue