From 2f026921ee331226900b3cd4f1bb238f6562b48d Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Mon, 5 May 2025 19:11:22 +0300 Subject: [PATCH] misc: Minor improvements (#1898) * misc: Minor improvements * Update functions.php * Update functions.php --- library/attach_mod/includes/functions_attach.php | 2 +- library/includes/functions.php | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/library/attach_mod/includes/functions_attach.php b/library/attach_mod/includes/functions_attach.php index ebfc48bcb..e2d7bc67a 100644 --- a/library/attach_mod/includes/functions_attach.php +++ b/library/attach_mod/includes/functions_attach.php @@ -342,7 +342,7 @@ function _set_var(&$result, $var, $type, $multibyte = false) * @param $var_name * @param $default * @param bool $multibyte - * @return array + * @return array|string */ function get_var($var_name, $default, $multibyte = false) { diff --git a/library/includes/functions.php b/library/includes/functions.php index 943648d29..e490ad930 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -2218,9 +2218,16 @@ function infoByIP(string $ipAddress, int $port = 0): array 'continent' => $json['continent'], 'continentCode' => $json['continentCode'] ]; - CACHE('bb_ip2countries')->set($cacheName, $data, 1200); } } + + if (empty($data)) { + $data = [ + 'response' => false, + 'timestamp' => TIMENOW + ]; + } + CACHE('bb_ip2countries')->set($cacheName, $data, 1200); } return $data;