From bd5992c6e97bb0d1ce45fca742921012fd7b015e Mon Sep 17 00:00:00 2001 From: Mats Mikkel Rummelhoff Date: Fri, 24 Mar 2023 14:17:00 +0100 Subject: [PATCH] Fix return type in getCurrentLinkForSite() --- CHANGELOG.md | 4 ++++ composer.json | 2 +- src/helpers/GeoMateHelper.php | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62e1e40..0402edd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # GeoMate Changelog +## 2.1.1 - 2023-03-24 +### Fixed +- Fixed a bug that could result in a PHP exception if a site link ended up being `null`. Fixes #58 + ## 2.1.0 - 2022-10-04 ### Changed - Auto-redirects based on browser language now always work, regardless of GeoMate having access to a geolocation database or not. #53 diff --git a/composer.json b/composer.json index fc2ca17..ac1c879 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "vaersaagod/geomate", "description": "GeoMate is a friend in need for all things geolocation. IP to geo lookup, automatic redirects (based on country, continent, language, etc), site switcher... You name it.", - "version": "2.1.0", + "version": "2.1.1", "type": "craft-plugin", "keywords": [ "craft", diff --git a/src/helpers/GeoMateHelper.php b/src/helpers/GeoMateHelper.php index 66ba6dd..83ee207 100644 --- a/src/helpers/GeoMateHelper.php +++ b/src/helpers/GeoMateHelper.php @@ -127,7 +127,7 @@ public static function getSiteLinks(): array return $r; } - public static function getCurrentLinkForSite(Site $site, bool $elementMatchOnly = false): bool|string + public static function getCurrentLinkForSite(Site $site, bool $elementMatchOnly = false): bool|null|string { // Get the site URL for the found site, this will be the fallback if we're not on an element's url $url = $elementMatchOnly ? null : $site->getBaseUrl();