From d0ea0011874e1c60b1e597d6ed1cca3d2715b64e Mon Sep 17 00:00:00 2001 From: Vladan Date: Fri, 28 Apr 2023 02:25:49 +0200 Subject: [PATCH 1/3] Update IPApi.php geoip.ERROR: ErrorException: Attempt to read property "status" on null in /home/laravel/public_html/vendor/torann/geoip/src/Services/IPApi.php:74 --- src/Services/IPApi.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Services/IPApi.php b/src/Services/IPApi.php index e76e3b1..9fba30a 100644 --- a/src/Services/IPApi.php +++ b/src/Services/IPApi.php @@ -71,7 +71,7 @@ public function locate($ip) $json = json_decode($data[0]); // Verify response status - if ($json->status !== 'success') { + if ($json && $json->status !== 'success') { throw new Exception('Request failed (' . $json->message . ')'); } From 9d6438be0a792f290b43d5b12e05f6c01cd741cf Mon Sep 17 00:00:00 2001 From: Vladan Date: Fri, 30 Jun 2023 01:36:18 +0200 Subject: [PATCH 2/3] Update IPApi.php sp --- src/Services/IPApi.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Services/IPApi.php b/src/Services/IPApi.php index 9fba30a..7ee3877 100644 --- a/src/Services/IPApi.php +++ b/src/Services/IPApi.php @@ -71,7 +71,7 @@ public function locate($ip) $json = json_decode($data[0]); // Verify response status - if ($json && $json->status !== 'success') { + if ( $json && $json->status !== 'success' ) { throw new Exception('Request failed (' . $json->message . ')'); } From b61541b0ed7bd56c93c776e241d3576a8be5acc2 Mon Sep 17 00:00:00 2001 From: Vladan Date: Fri, 22 Dec 2023 02:59:46 +0100 Subject: [PATCH 3/3] Update IPApi.php --- src/Services/IPApi.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Services/IPApi.php b/src/Services/IPApi.php index 7ee3877..7bb6462 100644 --- a/src/Services/IPApi.php +++ b/src/Services/IPApi.php @@ -71,13 +71,13 @@ public function locate($ip) $json = json_decode($data[0]); // Verify response status - if ( $json && $json->status !== 'success' ) { + if ( empty($json->status) && $json->status !== 'success' ) { throw new Exception('Request failed (' . $json->message . ')'); } return $this->hydrate([ 'ip' => $ip, - 'iso_code' => $json->countryCode, + 'iso_code' => !empty($json->countryCode)? $json->countryCode : '', 'country' => $json->country, 'city' => $json->city, 'state' => $json->region,