Wordpress crashes on set up. "There has been a critical error on this website."
Checklist
- [X] I have looked into the Readme and the documentation, and have not found a suitable solution or answer.
- [X] I have searched the issues and have not found a suitable solution or answer.
- [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- [X] I agree to the terms within the Auth0 Code of Conduct.
Description
WordPress crashes, displaying the message: "There has been a critical error on this website."
In the logs, I found the following error:
PHP Fatal error: Declaration of Auth0\WordPress\Cache\WpObjectCachePool::hasItem(string $key): bool must be compatible with Psr\Cache\CacheItemPoolInterface::hasItem($key) in /bitnami/wordpress/wp-content/plugins/vendor/auth0/wordpress/src/Cache/WpObjectCachePool.php on line 107
Reproduction
I am installing Auth0 v5 on Bitnami WordPress.
I cd into /opt/bitnami/wordpress/wp-content/plugins then I run:
composer require symfony/http-client nyholm/psr7 auth0/wordpress:^5.0
Additional Context
No response
wp-auth0 version
- 5.2.0
WordPress version
6.5.3
PHP version
8.2.13
I successfully got WordPress running by modifying the following lines of code. However, this change disrupted the functionality of Auth0. Now, users can log in but are unable to log out, and their sessions never expire.
--- /opt/bitnami/wordpress/wp-content/plugins/vendor/auth0/wordpress/src/Cache/WpObjectCachePool_ORIGINAL.php
+++ /opt/bitnami/wordpress/wp-content/plugins/vendor/auth0/wordpress/src/Cache/WpObjectCachePool_MY_CHANGES.php
@@ -59,7 +59,7 @@
return $success;
}
- public function deleteItem(string $key): bool
+ public function deleteItem($key): bool
{
return $this->wpDeleteItem($key);
}
@@ -77,7 +77,7 @@
return $deleted;
}
- public function getItem(string $key): CacheItemInterface
+ public function getItem($key): CacheItemInterface
{
return $this->wpGetItem($key);
}
@@ -104,7 +104,7 @@
return $items;
}
- public function hasItem(string $key): bool
+ public function hasItem($key): bool
{
return $this->getItem($key)
->isHit();
It appears that the issue arises because another plugin also utilizes a PSR. Deactivating the conflicting plugin resolves the following error: "PHP Fatal error: Declaration of Auth0\WordPress\Cache\WpObjectCachePool::hasItem(string $key): bool must be compatible with Psr\Cache\CacheItemPoolInterface::hasItem($key) in /bitnami/wordpress/wp-content/plugins/vendor/auth0/wordpress/src/Cache/WpObjectCachePool.php on line 107."
However, after deactivation, the site is experiencing further issues. Users are unable to log out, Elementor is non-functional, sessions do not expire, and each time I attempt to deactivate a plugin, I receive the error message: "The link you followed has expired."
This problem is likely related to cookies or caching.
Hi @serance 👋 Unfortunately, this is a common occurrence with Composer dependencies. As you identified, you're seeing another plugin in your install that requires an old version of the PSR-6 specification (either v1 or v2), while our plugin supports v3, which introduced type-hinting. This is not a unique problem for our plugin and is not something we can address.
We cannot relax our version constraint on the dependency, and doing so would simply be kicking the proverbial can down the road for yet other plugins. The conflicting plugin you identified must update its PSR-6 dependency to avoid creating these kinds of conflicts.
Your follow-up question is welcome. Please feel free to create a new issue around it and provide any additional details you can to help us troubleshoot together.