• Resolved audpxi

    (@audpxi)


    Hi! Unfortunately our sites crash when using this plugin with our custom theme, error:

    Fatal error: Declaration of Detection\Cache\Cache::get(string $key, mixed $default = null): mixed must be compatible with Psr\SimpleCache\CacheInterface::get($key, $default = null) in /app/public/wp-content/plugins/adv-geoip-redirect/vendor/mobiledetect/mobiledetectlib/src/Cache/Cache.php on line 26

    I think it happens because the plugin’s Cache class uses simple-cache with type hints and our sites theme loads an older simple-cache v1.0.1 that has no type hints.

    I tested the plugin by removing type hints and declare(strict_types=1) from Cache.php and after that it worked flawlessly.

    Is there anything that can be done to support older themes as well?

    Also one feature recommendation: it would be nice to be able to disable redirection for admins, because on our sites we use Beaver Builder which is a front end site builder. That means we have to disable redirection manually every time to be able edit the page where user is being redirected from.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sajjad Hossain Sagor

    (@sajjad67)

    Hi @audpxi Can you please let us know how to reproduce the issue? Thanks

    Thread Starter audpxi

    (@audpxi)

    Hi! Our theme uses Sage Roots 9 starter theme as base, which uses psr/simple-cache ~1.0 installed by Composer. So I suppose using a theme based on Sage Roots 9, or any theme that loads older psr/simple-cache, with the plugin for any WordPress site would trigger the error when redirecting user.

    I think that theme loads dependencies before plugins and when one version of simple-cache is already loaded, newer one is not loaded at all.

    Plugin Author Sajjad Hossain Sagor

    (@sajjad67)

    A new version is published with your requested feature disable redirection for admins. Please update to the latest version. As per the test, composer create-project roots/sage my-theme it does load the themes\my-theme\vendor\psr\simple-cache\src\CacheInterface.php with type hints, maybe you are using a old version. It is recommended to update to the latest version.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.