Comments (3)
Thanks for reporting that @mateostabio. That exception is due to a bug in GeoMate which is triggered by the stricter typing in PHP 8 – I'll get that fixed ASAP.
The exception will only happen when a site's baseUrl
is null/empty, so to circumvent the issue until I can get this patched you might want to filter out any sites without URLs:
{% set sites = craft.app.getSites().getGroupById(currentSite.groupId).getSites() | filter(site => site.baseUrl is not empty) %}
...
{% for site in sites %}
...
...which is what the {% for site in sites if site.baseUrl is not empty %}
conditional accomplished previously, but Twig has removed support for if
statements within {% for %}
tags in v. 3, which is what Craft 4 ships with.
from geomate.
Thanks for the quick reply! But it's still throwing this error:
2023-03-24 12:40:56 [web.ERROR] [TypeError] vaersaagod\geomate\helpers\GeoMateHelper::getCurrentLinkForSite(): Return value must be of type string|bool, null returned {"trace":["#0 /app/vendor/vaersaagod/geomate/src/services/RedirectService.php(114): vaersaagod\geomate\helpers\GeoMateHelper::getCurrentLinkForSite(Object(craft\models\Site), true)","#1 /app/vendor/vaersaagod/geomate/src/services/RedirectService.php(43): vaersaagod\geomate\services\RedirectService->getRedirectInfo()","#2 /app/vendor/vaersaagod/geomate/src/GeoMate.php(179): vaersaagod\geomate\services\RedirectService->autoRedirect()","#3 /app/vendor/vaersaagod/geomate/src/GeoMate.php(127): vaersaagod\geomate\GeoMate->redirectCheck()","#4 [internal function]: vaersaagod\geomate\GeoMate->vaersaagod\geomate\{closure}(Object(yii\base\Event))","#5 /app/vendor/yiisoft/yii2/base/Component.php(633): call_user_func(Object(Closure), Object(yii\base\Event))","#6 /app/vendor/craftcms/cms/src/base/ApplicationTrait.php(1560): yii\base\Component->trigger('init')","#7 /app/vendor/craftcms/cms/src/web/Application.php(106): craft\web\Application->_postInit()","#8 /app/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Application->init()","#9 /app/vendor/yiisoft/yii2/base/Application.php(204): yii\base\BaseObject->__construct(Array)","#10 [internal function]: yii\base\Application->__construct(Array)","#11 /app/vendor/yiisoft/yii2/di/Container.php(419): ReflectionClass->newInstanceArgs(Array)","#12 /app/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build('craft\\web\\Appli...', Array, Array)","#13 /app/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('craft\\web\\Appli...', Array, Array)","#14 /app/vendor/craftcms/cms/src/Craft.php(54): yii\BaseYii::createObject(Array, Array)","#15 /app/vendor/craftcms/cms/bootstrap/bootstrap.php(252): Craft::createObject(Array)","#16 /app/vendor/craftcms/cms/bootstrap/web.php(40): require('/app/vendor/cra...')","#17 /app/web/index.php(11): require('/app/vendor/cra...')","#18 {main}"],"memory":8570400,"exception":"[object] (TypeError(code: 0): vaersaagod\geomate\helpers\GeoMateHelper::getCurrentLinkForSite(): Return value must be of type string|bool, null returned at /app/vendor/vaersaagod/geomate/src/helpers/GeoMateHelper.php:147)"}
from geomate.
Sorry, on further thought I guess that fix wouldn't have worked regardless as the issue was a return type conflict internally in GeoMate.
Should be fixed in GeoMate 2.1.1 though!
from geomate.
Related Issues (20)
- Should Geomate read and redirect based on GeoMateRedirectOverride cookie? HOT 2
- How to access geomate data in another plugin? HOT 2
- Allow disabling override paramter value completely HOT 3
- Macro "copyTextField" is not defined in template "_includes/forms". HOT 1
- addOverrideParam does funny things HOT 2
- Since updating to Craft 3.7 there have been many reports of re-direct loops occurring resulting in time outs HOT 5
- Feature request: Provide currency information
- Site Groups HOT 2
- Is there a way to autoRedirectEnabled only on first time page load? HOT 2
- craft.geomate.country.country.name null when using forced IP locally HOT 1
- Error when using 'redirectMapSimpleModeKey' => 'language', HOT 2
- Exception thrown when GeoIP databases are missing and `redirectMapSimpleModeKey` is set to `'language'`
- Auto-redirects based on browser-language should work regardless of GeoIP2 databases being present or not
- When assigned countries to the redirectMap they must be lower case otherwise the redirects won't work HOT 1
- Add setting for local IP HOT 1
- How to check what State/Province visitor is in?
- Issue when behind NordVPN HOT 5
- 3.0.0-beta.1 - error when used with commerce 5 HOT 1
- No database found!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geomate.