Skip to content

Move WeakMap initialization to PHP 8.2+#818

Merged
agibson-godaddy merged 3 commits intorelease/6.1.3from
mwc-19377/weakmap-errors
Apr 1, 2026
Merged

Move WeakMap initialization to PHP 8.2+#818
agibson-godaddy merged 3 commits intorelease/6.1.3from
mwc-19377/weakmap-errors

Conversation

@agibson-godaddy
Copy link
Copy Markdown
Contributor

@agibson-godaddy agibson-godaddy commented Mar 31, 2026

Summary

This moves the WeakMap prerequisite from PHP 8.0+ to PHP 8.2+.

Story: MWC-19377

Release: #1234 (release PR)

Details

Some customers were running into fatal errors when using older versions of PHP 8.0.x and 8.1.x:

Uncaught TypeError: WeakMap key must be an object
in /wp-content/plugins/woocommerce-gateway-authorize-net-cim/vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/Dynamic_Props.php:73

We tracked that back to php/php-src#8995

This is a bug in PHP which has now been resolved in:

  • More recent patched versions of 8.0
  • More recent patched versions of 8.1
  • 8.2+ (fully)

The problem is with customers running on those older, unpatched versions of PHP. They run into the fatal error, with no way to fix it.

The dynamic props deprecation warning doesn't kick in until PHP 8.2+ anyway so we've decided to move the activation threshold to PHP 8.2+, which fully resolves the problem.

QA

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 adjusts the framework’s Dynamic_Props WeakMap usage to only activate on PHP 8.2+, avoiding fatal errors seen on older/unpatched PHP 8.0.x and 8.1.x when storing order-related dynamic properties.

Changes:

  • Switch WeakMap enablement from PHP 8.0+ to PHP 8.2+ in Dynamic_Props::use_weak_map().
  • Update related inline/docs (@since tags, comments) to reflect the new PHP 8.2+ threshold.
  • Add a changelog entry documenting the change.

Reviewed changes

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

File Description
woocommerce/payment-gateway/Dynamic_Props.php Updates WeakMap gating logic to PHP 8.2+ and adjusts related doc/comments.
woocommerce/changelog.txt Adds a 6.1.3 changelog entry describing the WeakMap threshold change.

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@agibson-godaddy agibson-godaddy marked this pull request as ready for review April 1, 2026 08:32
@agibson-godaddy agibson-godaddy merged commit 90d5f41 into release/6.1.3 Apr 1, 2026
5 checks passed
@agibson-godaddy agibson-godaddy deleted the mwc-19377/weakmap-errors branch April 1, 2026 08:32
agibson-godaddy added a commit that referenced this pull request Apr 1, 2026
* Version 6.1.3

* Address GH workflow deprecation warnings (#817)

* Update action versions

* Replace deprecated set-output

* Update pull request template (#819)

* Move WeakMap initialization to PHP 8.2+ (#818)

* Move WeakMap initialization to PHP 8.2+

* Document 8.2 reasoning

* Wording tweaks

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Set release date

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ashley Gibson <99189195+agibson-godaddy@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

2 participants