Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wordpress crashes on set up. "There has been a critical error on this website." #900

Closed
4 tasks done
seranca opened this issue May 23, 2024 · 3 comments
Closed
4 tasks done

Comments

@seranca
Copy link

seranca commented May 23, 2024

Checklist

  • I have looked into the Readme and the documentation, and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • 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

@seranca
Copy link
Author

seranca commented May 24, 2024

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();

@seranca seranca closed this as completed May 24, 2024
@seranca seranca reopened this May 24, 2024
@seranca
Copy link
Author

seranca commented May 26, 2024

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.

@evansims
Copy link
Member

evansims commented May 27, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants