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

Hotfix: Prevent PHP fatal error when trying to delete a term #2650

Merged
merged 3 commits into from May 14, 2020

Conversation

Tabrisrp
Copy link
Contributor

@Tabrisrp Tabrisrp commented May 14, 2020

PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function WP_Rocket\Engine\Cache\PurgeActionsSubscriber::maybe_purge_cache_on_term_change(), 2 passed in /home/aswakdriwr/delivery/wp-includes/class-wp-hook.

This happens because pre_delete_terms uses 2 arguments only. I used this hook at the start of the work on the PR, then noticed I could use delete_term instead, and forgot to update the hook name in get_subscribed_events().

The error wasn't reported during QA.

  • Use delete_term instead of pre_delete_term hook
  • Update tests
  • QA

@Tabrisrp Tabrisrp added type: bug Indicates an unexpected problem or unintended behavior module: cache priority: high Issues which should be resolved as quickly as possible labels May 14, 2020
@Tabrisrp Tabrisrp self-assigned this May 14, 2020
@piotrbak piotrbak self-requested a review May 14, 2020 14:37
Copy link
Contributor

@piotrbak piotrbak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replicated issue before this fix. Removing the term works correctly after applying the patch.

@Tabrisrp Tabrisrp merged commit d6c6118 into master May 14, 2020
@Tabrisrp Tabrisrp deleted the fix/fatal-delete-term branch May 14, 2020 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: cache priority: high Issues which should be resolved as quickly as possible type: bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants