{"id":18748283,"date":"2025-12-09T07:34:27","date_gmt":"2025-12-09T07:34:27","guid":{"rendered":"https:\/\/wordpress.org\/support\/?post_type=topic&#038;p=18748283"},"modified":"2025-12-09T07:55:36","modified_gmt":"2025-12-09T07:55:36","slug":"fatal-error-on-cache-php","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/fatal-error-on-cache-php\/","title":{"rendered":"Fatal error on Cache.php"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hi! Unfortunately our sites crash when using this plugin with our custom theme, error:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I think it happens because the plugin&#8217;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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I tested the plugin by removing type hints and declare(strict_types=1) from Cache.php and after that it worked flawlessly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Is there anything that can be done to support older themes as well?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n","protected":false},"template":"","class_list":["post-18748283","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18748283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18748283\/revisions"}],"predecessor-version":[{"id":18748302,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18748283\/revisions\/18748302"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=18748283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}