Skip to content

[Backport to release/10.9] Fix fatal error from FeedInterface::get_entry_count() breaking older WooCommerce Stripe Gateway#65972

Merged
mordeth merged 1 commit into
release/10.9from
cherry-pick-PR65965-to-release/10.9
Jun 24, 2026
Merged

[Backport to release/10.9] Fix fatal error from FeedInterface::get_entry_count() breaking older WooCommerce Stripe Gateway#65972
mordeth merged 1 commit into
release/10.9from
cherry-pick-PR65965-to-release/10.9

Conversation

@woocommercebot

Copy link
Copy Markdown
Collaborator

This PR is a cherry-pick of #65965 to release/10.9.

Original PR Description

Submission Review Guidelines:

Changes proposed in this Pull Request:

PR #64394 added get_entry_count(): int as a required method on FeedInterface (shipped in 10.9.0). Because that interface is implemented by third-party code — notably the WooCommerce Stripe Gateway's WC_Stripe_Agentic_Commerce_Csv_Feed — adding a required method is a backward-incompatible change. Stripe Gateway versions that predate their own get_entry_count() implementation (added in Stripe 10.7) fatal on load under 10.9.0:

PHP Fatal error: Class WC_Stripe_Agentic_Commerce_Csv_Feed contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Automattic\WooCommerce\Internal\ProductFeed\Feed\FeedInterface::get_entry_count) in .../woocommerce-gateway-stripe/includes/agentic-commerce/class-wc-stripe-agentic-commerce-csv-feed.php on line 31

This forced a revert of the 10.9.0 tag on WP Cloud. No core code calls get_entry_count() through the interface — it is only used on the concrete JsonFileFeed, and consumers (like Stripe) call it on their own feed classes. This PR removes the method from the interface to restore compatibility, keeping the implementation and its tests on JsonFileFeed intact.

Bug introduced in PR #64394.

How to test the changes in this Pull Request:

  1. Check out a copy of the WooCommerce Stripe Gateway at a version before its own get_entry_count() was added (Stripe < 10.7), so its WC_Stripe_Agentic_Commerce_Csv_Feed implements FeedInterface without get_entry_count().
  2. On trunk before this change, activate both WooCommerce and that Stripe Gateway version (or require the feed class) and confirm the fatal error above is raised.
  3. Check out this branch and repeat — the class loads without a fatal error.
  4. Confirm core feed behaviour is unchanged: pnpm --filter=@woocommerce/plugin-woocommerce test:php:env -- --filter 'JsonFileFeedTest|ProductWalkerTest' passes (19 tests / 453 assertions), including JsonFileFeed::get_entry_count() coverage.

Testing that has already taken place:

  • pnpm --filter=@woocommerce/plugin-woocommerce test:php:env -- --filter 'JsonFileFeedTest|ProductWalkerTest' — 19 tests, 453 assertions, all passing.
  • pnpm --filter=@woocommerce/plugin-woocommerce lint:php:changes — clean.
  • composer exec -- phpstan analyse .../FeedInterface.php .../JsonFileFeed.php --memory-limit=2G — no errors.

Milestone

Note: Check the box above to have the milestone automatically assigned when merged.
Alternatively (e.g. for point releases), manually assign the appropriate milestone.

Changelog entry

  • Automatically create a changelog entry from the details below.

  • This Pull Request does not require a changelog entry. (Comment required below)

Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Remove get_entry_count() from the product feed FeedInterface to restore backward compatibility with third-party implementations.

Changelog Entry Comment

Comment

Created manually.

Release Communication

Select if this PR needs a generated summary for release notes:

  • Feature Highlight - For user-facing features (what changed, user impact)
  • Developer Advisory - For developer-facing changes (what changed, how to detect, actions needed)

…WooCommerce Stripe Gateway (#65965)

Remove get_entry_count() from product feed FeedInterface

PR #64394 added get_entry_count() as a required method on FeedInterface,
shipping in 10.9.0. Because the interface is implemented by third-party
code — notably the WooCommerce Stripe Gateway's
WC_Stripe_Agentic_Commerce_Csv_Feed — adding a required method is a
backward-incompatible change. Stripe versions that predate their own
get_entry_count() implementation (added in Stripe 10.7) fatal on load
under 10.9.0:

  Class WC_Stripe_Agentic_Commerce_Csv_Feed contains 1 abstract method
  and must therefore be declared abstract or implement the remaining
  methods (...FeedInterface::get_entry_count)

No core code calls get_entry_count() through the interface; the method is
only used on the concrete JsonFileFeed (and by consumers on their own feed
classes). Remove it from the interface to restore compatibility, keeping
the implementation and its tests on JsonFileFeed intact.

Refs #64394
@woocommercebot woocommercebot requested a review from mordeth June 24, 2026 10:23
@github-actions github-actions Bot added this to the 10.9.0 milestone Jun 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Testing Guidelines

Hi @mordeth ,

Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed.

Reminder: PR reviewers are required to document testing performed. This includes:

  • 🖼️ Screenshots or screen recordings.
  • 📝 List of functionality tested / steps followed.
  • 🌐 Site details (environment attributes such as hosting type, plugins, theme, store size, store age, and relevant settings).
  • 🔍 Any analysis performed, such as assessing potential impacts on environment attributes and other plugins, conducting performance profiling, or using LLM/AI-based analysis.

⚠️ Within the testing details you provide, please ensure that no sensitive information (such as API keys, passwords, user data, etc.) is included in this public issue.

@github-actions

Copy link
Copy Markdown
Contributor

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Test this pull request with WordPress Playground.

Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a commit that changes plugin code.

@mordeth mordeth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

developer advisory metric: feature freeze exception A tracking label for PRs that were merged after the feature freeze. plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants