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

Fix PHP fatal error if Add On check returns null #3249

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

dparker1005
Copy link
Member

All Submissions:

Changes proposed in this Pull Request:

We saw the following fatal error on the plugins/updates page if the site fails to retrieve the list of Add Ons:

An error of type E_ERROR was caused in line 59 of the file /.../wp-content/plugins/paid-memberships-pro/includes/addons.php. Error message: Uncaught TypeError: array_column(): Argument #1 ($array) must be of type array, null given in /.../wp-content/plugins/paid-memberships-pro/includes/addons.php:59 Stack trace: #0 /.../wp-content/plugins/paid-memberships-pro/includes/addons.php(59): array_column() #1 /.../wp-content/plugins/paid-memberships-pro/includes/addons.php(265): pmpro_getAddons() #2 /.../wp-includes/class-wp-hook.php(326): pmpro_update_plugins_filter() #3 ......

This PR checks whether $addons is empty to avoid passing null into array_column().

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully run tests with your changes locally?

Changelog entry

Enter a summary of all changes on this Pull Request. This will appear in the changelog if accepted.

@dparker1005 dparker1005 merged commit d90bf4e into strangerstudios:dev Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants