WPDiscourse - Uitloggen werkt niet

AI-generated summary

The discussion revolves around a bug in the WPDiscourse plugin where the logout functionality fails, resulting in a fatal error due to an incorrect use of a stdClass object as an array in http.php. Fma965 reported the issue, noting it occurs with the latest WordPress, Discourse Connect, and PHP 8, while using WordPress as a DiscourseConnect client. angus confirmed it’s a legitimate bug affecting users with sync logout enabled and provided a fix in a pull request. simon announced the release of version 2.4.5, which resolves the issue. Fma965 confirmed the fix but noted they had already switched their setup to use WordPress as the provider, making testing unnecessary.

?request=logout

Results in the following

Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /var/www/vhosts/localhost/html/wp-includes/http.php:251 Stack trace: #0 /var/www/vhosts/localhost/html/wp-content/plugins/wp-discourse/lib/plugin-utilities.php(188): wp_remote_retrieve_response_code() #1 /var/www/vhosts/localhost/html/wp-content/plugins/wp-discourse/lib/sso-client/client.php(477): WPDiscourse\DiscourseBase->validate() #2 /var/www/vhosts/localhost/html/wp-includes/class-wp-hook.php(307): WPDiscourse\SSOClient\Client->logout_from_discourse() #3 /var/www/vhosts/localhost/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters() #4 /var/www/vhosts/localhost/html/wp-includes/plugin.php(476): WP_Hook->do_action() #5 /var/www/vhosts/localhost/html/wp-includes/pluggable.php(1104): do_action() #6 /var/www/vhosts/localhost/html/wp-includes/pluggable.php(660): wp_clear_auth_cookie() #7 /var/www/vhosts/localhost/html/wp-content/plugins/wp-discourse/lib/sso-client/query-redirect.php(68): wp_logout() #8 /var/www/vhosts/localhost/html/wp-includes/class-wp-hook.php(307): WPDiscourse\SSOClient\QueryRedirect->discourse_sso_url_redirect() #9 /var/www/vhosts/localhost/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters() #10 /var/www/vhosts/localhost/html/wp-includes/plugin.php(524): WP_Hook->do_action() #11 /var/www/vhosts/localhost/html/wp-includes/class-wp-query.php(1104): do_action_ref_array() #12 /var/www/vhosts/localhost/html/wp-includes/class-wp-query.php(1792): WP_Query->parse_query() #13 /var/www/vhosts/localhost/html/wp-includes/class-wp-query.php(3586): WP_Query->get_posts() #14 /var/www/vhosts/localhost/html/wp-includes/class-wp-query.php(3718): WP_Query->query() #15 /var/www/vhosts/localhost/html/wp-content/plugins/happyfiles-pro/includes/data.php(197): WP_Query->__construct() #16 /var/www/vhosts/localhost/html/wp-includes/class-wp-hook.php(307): HappyFiles\Data::get_folders() #17 /var/www/vhosts/localhost/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters() #18 /var/www/vhosts/localhost/html/wp-includes/plugin.php(476): WP_Hook->do_action() #19 /var/www/vhosts/localhost/html/wp-settings.php(598): do_action() #20 /var/www/vhosts/localhost/html/wp-config.php(85): require_once('...') #21 /var/www/vhosts/localhost/html/wp-load.php(50): require_once('...') #22 /var/www/vhosts/localhost/html/wp-blog-header.php(13): require_once('...') #23 /var/www/vhosts/localhost/html/index.php(17): require('...') #24 {main} thrown in /var/www/vhosts/localhost/html/wp-includes/http.php on line 251

I’ll take a look at this first thing tomorrow morning CET.

No problem thanks, it may be something on my end but would be good to know if you can replicate it or not,

it’s the latest version of Wordpress and Discourse Connect and Discourse.

It’s also PHP 8 (which might be the issue?)

I am using DiscourseConnect as a client not a provider, not sure if that matters?

I will eventually swap it over to Wordpress as the provider but I need to determine the best way to migrate all users :laughing:

@Fma965 This is a legit bug. It’s been there for almost a year. It occurs when

  • using WP as the DiscourseConnect client;
  • when sync logout is enabled; and
  • (it also depends on your php error handling)

Thanks for reporting it!

Once this is PR is merged and 2.4.5 is released it will be fixed

https://github.com/discourse/wp-discourse/pull/451

cc @simon

Thanks @Fma965 and @angus, WP Discourse version 2.4.5 is available in the WordPress repo now.

Thanks Angus, i have already switched the SSO direction around, was simpler than i thought it would be, just imported the users and flagged as being verified already and then get the users to password reset.

Anyway because of this i can’t test it but i’m sure it works as intended thanks for sorting so quickly.

and thanks @simon for releasing it