strangerstudios / pmpro-sponsored-members

Generate a discount code for a main account holder to distribute to sponsored members.
https://www.paidmembershipspro.com/add-ons/pmpro-sponsored-members/
15 stars 27 forks source link

Fatal error with PHP version 8.0.16 #110

Closed michaelbeil closed 1 year ago

michaelbeil commented 2 years ago

Describe the bug WordPress caught a fatal error with Paid Memberships Pro – Sponsored Members Add On and PHP version 8.0.16 as reported in ticket 411269 (moderators only).

To Reproduce I cannot reproduce this error, but the customer experienced this error:

  1. Change the expiration date of an expired member from the WP admin panel.
  2. Received the following error:

“There has been a critical error on this website. Please check your site admin email inbox for instructions.

Learn more about troubleshooting WordPress.”

Then I checked my inbox and received the following email:

“Howdy!

Since WordPress 5.2 there is a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email.

In this case, WordPress caught an error with one of your plugins, Paid Memberships Pro – Sponsored Members Add On.

First, visit your website and check for any visible issues. Next, visit the page where the error was caught (https://site.org/wp-admin/user-edit.php) and check for any visible issues.

Please contact your host for assistance with investigating this issue further.

If your site appears broken and you can’t access your dashboard normally, WordPress now has a special “recovery mode”. This lets you safely login to your dashboard and investigate further.

To keep your site safe, this link will expire in 1 day. Don’t worry about that, though: a new link will be emailed to you if the error occurs again after it expires.

Error Details

An error of type E_ERROR was caused in line 342 of the file /home3/norotonm/public_html/wp-content/plugins/pmpro-sponsored-members/pmpro-sponsored-members.php. Error message: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /home3/norotonm/public_html/wp-content/plugins/pmpro-sponsored-members/pmpro-sponsored-members.php:342
Stack trace:
#0 /public_html/wp-content/plugins/pmpro-sponsored-members/pmpro-sponsored-members.php(342): in_array(’16’, NULL)
#1 /public_html/wp-content/plugins/pmpro-sponsored-members/pmpro-sponsored-members.php(216): pmprosm_sponsored_account_change(‘1’, 15)
#2 /public_html/wp-includes/class-wp-hook.php(309): pmprosm_pmpro_after_change_membership_level(‘1’, 15)
#3 /public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
#4 /public_html/wp-includes/plugin.php(474): WP_Hook->do_action(Array)
#5 /public_html/wp-content/plugins/paid-memberships-pro/includes/functions.php(1247): do_action(‘pmpro_after_cha…’, ‘1’, 15, NULL)
#6 /public_html/wp-content/plugins/paid-memberships-pro/includes/profile.php(287): pmpro_changeMembershipLevel(‘1’, 15, ‘admin_changed’)
#7 /public_html/wp-includes/class-wp-hook.php(307): pmpro_membership_level_profile_fields_update(15)
#8 /public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(”, Array)
#9 //public_html/wp-includes/plugin.php(474): WP_Hook->do_action(Array)
#10 /public_html/wp-admin/user-edit.php(153): do_action(‘edit_user_profi…’, 15)
#11 {main}
thrown”

Expected behavior I expect there not to be an error.

WordPress Environment

``` Paid Memberships Pro 2.7.5, Paid Memberships Pro – Sponsored Members Add On version 0.10, WordPress version 5.9.2, PHP version 8.0.16 ```
michaelbeil commented 1 year ago

Another customer (ticket 492343) is experiencing this with PHP 8.1.14.