Title: PHP 8 support
Last modified: March 16, 2022

---

# PHP 8 support

 *  [klivie](https://wordpress.org/support/users/klivie/)
 * (@klivie)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/php-8-support-27/)
 * Hi,
 * After updating our site to PHP 8 this plugin keeps errorin and stops the user
   from being able to login via the CMS.
 * Error output below:
 *     ```
       2022/03/16 15:12:57 [error] 8708#8708: *315943 FastCGI sent in stderr: "PHP message: PHP Warning:  Attempt to read property "user_pass" on null in {SITE_ROOT}/www/wp-content/plugins/wp-members/includes/class-wp-members-user.php on line 1163PHP message: PHP Warning:  Attempt to read property "ID" on null in {SITE_ROOT}/www/wp-content/plugins/wp-members/includes/class-wp-members-user.php on line 1163PHP message: PHP Fatal error:  Uncaught TypeError: hash_equals(): Argument #1 ($known_string) must be of type string, null given in {SITE_ROOT}/www/wp-includes/pluggable.php:2447
       Stack trace:
       #0 {SITE_ROOT}/www/wp-includes/pluggable.php(2447): hash_equals()
       #1 {SITE_ROOT}/www/wp-content/plugins/wp-members/includes/class-wp-members-user.php(1163): wp_check_password()
       #2 {SITE_ROOT}/www/wp-includes/class-wp-hook.php(307): WP_Members_User->check_activated()
       #3 {SITE_ROOT}/www/wp-includes/plugin.php(189): WP_Hook->apply_filters()
       #4 {SITE_ROOT}/www/wp-includes/pluggable.php(608): apply_filters()
       #5 {SITE_ROOT}/www/wp-includes/user.php(95): wp_authenticate()
       #6 {SITE_ROOT}/www/wp-login.php(1211): wp_signon()
       #7 {main}
         thrown in {SITE_ROOT}" while reading response header from upstream, client: 46.69.230.249, server: www.{SITE_ROOT}, request: "POST /wp-login.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php8.0-fpm-norfolkcare:", host: "{SITE_ROOT}", referrer: "http://{SITE_ROOT}/wp-login.php?redirect_to=http%3A%2F%2F{SITE_ROOT}%2Fwp-admin%2F&reauth=1"
       ```
   
 * Would be great if we could get this fixed please 🙂

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

 *  Plugin Author [Chad Butler](https://wordpress.org/support/users/cbutlerjr/)
 * (@cbutlerjr)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/php-8-support-27/#post-15465586)
 * All development for the plugin currently is done on PHP 8.x.
 * What version of the plugin is installed?
 *  Thread Starter [klivie](https://wordpress.org/support/users/klivie/)
 * (@klivie)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/php-8-support-27/#post-15472614)
 * Hi Chad,
 * We’re using the most recent version of the plugin.
 * Version 3.4.1.2
 * Thanks,
    Kurt
 *  Plugin Author [Chad Butler](https://wordpress.org/support/users/cbutlerjr/)
 * (@cbutlerjr)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/php-8-support-27/#post-15481392)
 * This one puzzled my a little bit because it is not reproduced in development.
   The line in question is part of the `WP_Members_User::check_activated()` method,
   which runs when a user logs in to make sure they have been activated.
 * This is triggered by the WP action hook `authenticate`, which fires during the`
   wp_signon()` process. It’s a general WP hook that any plugin can use.
 * The issue from your error message appears to be that the `$user` object passed
   during the action is `null`. That’s not a usual state when the user is logging
   in, although it is a possible state. Ordinarily, in a normal setup, it would 
   be either the `$user` being validated or it would be a WP error object.
 * My guess is that you have another plugin that is hooking into `authenticate` 
   that during whatever it does it returning a null value, and the `check_activated()`
   function does not account for that.
 * One way to check that would be to test with other plugins deactivated to see 
   if you can isolate whether that’s the case.
 * In the meantime, I believe that the logic in the `check_activated()` function
   can be improved to account for the possibility of a null value in the `$user`
   parameter. I’ll be doing that in the next release. If you want to change it now
   to see if that resolves the issue, you can make the following change.
 * In wp-members/includes/class-wp-members-user.php at line 1163, you’ll see the
   following:
 * `$pass = ( ( ! is_wp_error( $user ) ) && $password ) ? wp_check_password( $password,
   $user->user_pass, $user->ID ) : false;`
 * Change it to this:
 * `$pass = ( ! is_wp_error( $user ) && ! is_null( $user ) && $password ) ? wp_check_password(
   $password, $user->user_pass, $user->ID ) : false;`

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

The topic ‘PHP 8 support’ is closed to new replies.

 * ![](https://ps.w.org/wp-members/assets/icon-256x256.png?rev=1226414)
 * [WP-Members Membership Plugin](https://wordpress.org/plugins/wp-members/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-members/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-members/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-members/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-members/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-members/reviews/)

## Tags

 * [php-error](https://wordpress.org/support/topic-tag/php-error/)

 * 3 replies
 * 2 participants
 * Last reply from: [Chad Butler](https://wordpress.org/support/users/cbutlerjr/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/php-8-support-27/#post-15481392)
 * Status: not resolved