Skip to content

Protect against Notes_Helper fatal errors during plugin updates#826

Merged
agibson-godaddy merged 1 commit intorelease/6.1.5from
mwc-19419/note-helper-error
Apr 2, 2026
Merged

Protect against Notes_Helper fatal errors during plugin updates#826
agibson-godaddy merged 1 commit intorelease/6.1.5from
mwc-19419/note-helper-error

Conversation

@agibson-godaddy
Copy link
Copy Markdown
Contributor

@agibson-godaddy agibson-godaddy commented Apr 1, 2026

Summary

This adds some various protection measures to avoid Notes_Helper fatal errors during plugin updates, which is when the framework namespace changes.

Fixes #824

Story: MWC-19419

Release: #825 (release PR)

QA

  • Code review
  • Checks pass

Before merge

  • I have confirmed these changes in each supported minor WooCommerce version

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens the framework against fatal errors triggered during plugin updates via /wp-admin/update-core.php, where versioned framework namespaces can change mid-request and cause Notes_Helper class resolution failures.

Changes:

  • Guard Notes_Helper usage during deactivation with class_exists() to avoid upgrade-time fatals.
  • Widen the gateway notice creation try/catch from \Exception to \Throwable and add a class_exists() guard before calling Admin\Notes_Helper::note_with_name_exists().
  • Add a changelog entry for the fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
woocommerce/Plugin/Lifecycle.php Adds a class_exists( Notes_Helper::class ) guard before deleting admin notes during deactivation to prevent upgrade-time fatals.
woocommerce/payment-gateway/class-sv-wc-payment-gateway-plugin.php Catches \Throwable around note creation and guards note-deletion checks with class_exists() to prevent namespace-mismatch fatals during updates.
woocommerce/changelog.txt Documents the fix for Notes_Helper fatal errors during plugin upgrades.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@agibson-godaddy agibson-godaddy mentioned this pull request Apr 2, 2026
2 tasks
@agibson-godaddy agibson-godaddy merged commit 9e04b12 into release/6.1.5 Apr 2, 2026
9 checks passed
@agibson-godaddy agibson-godaddy deleted the mwc-19419/note-helper-error branch April 2, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fatal error: Admin\Notes_Helper not found during plugin update via update-core.php

2 participants