Skip to content

Fix fatal error from FeedInterface::get_entry_count() breaking older WooCommerce Stripe Gateway#65965

Merged
mordeth merged 2 commits into
trunkfrom
fix/feed-interface-bc-break-get-entry-count
Jun 24, 2026
Merged

Fix fatal error from FeedInterface::get_entry_count() breaking older WooCommerce Stripe Gateway#65965
mordeth merged 2 commits into
trunkfrom
fix/feed-interface-bc-break-get-entry-count

Conversation

@mordeth

@mordeth mordeth commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

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)

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
@github-actions github-actions Bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Jun 24, 2026
@mordeth mordeth marked this pull request as ready for review June 24, 2026 08:21
@mordeth mordeth self-assigned this Jun 24, 2026
@mordeth mordeth requested review from a team, malithsen and wjrosa and removed request for a team June 24, 2026 08:21
@github-actions

Copy link
Copy Markdown
Contributor

Testing Guidelines

Hi @malithsen @wjrosa @woocommerce/quark,

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.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 2333278c-4ea7-4a53-a054-207526c6f8ae

📥 Commits

Reviewing files that changed from the base of the PR and between 1b3f5b7 and 2474606.

📒 Files selected for processing (3)
  • plugins/woocommerce/changelog/fix-feed-interface-bc-break-get-entry-count
  • plugins/woocommerce/src/Internal/ProductFeed/Feed/FeedInterface.php
  • plugins/woocommerce/src/Internal/ProductFeed/Storage/JsonFileFeed.php
💤 Files with no reviewable changes (1)
  • plugins/woocommerce/src/Internal/ProductFeed/Feed/FeedInterface.php

📝 Walkthrough

Walkthrough

get_entry_count(): int is removed from FeedInterface to restore backward compatibility with third-party implementations that did not define it. The method is retained on JsonFileFeed with an updated PHPDoc that describes the entry_count semantics and adds a @since 10.9.0 tag. A changelog entry documents the fix.

Changes

FeedInterface BC Fix

Layer / File(s) Summary
Remove method from FeedInterface, update JsonFileFeed PHPDoc
plugins/woocommerce/src/Internal/ProductFeed/Feed/FeedInterface.php, plugins/woocommerce/src/Internal/ProductFeed/Storage/JsonFileFeed.php, plugins/woocommerce/changelog/fix-feed-interface-bc-break-get-entry-count
get_entry_count(): int declaration is removed from FeedInterface; JsonFileFeed::get_entry_count() PHPDoc is updated to document the meaning of entry_count (including silent validation drops) and adds @since 10.9.0; changelog entry records the patch-level fix.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • woocommerce/woocommerce#64394: This PR directly reverts the contract change from #64394 by removing get_entry_count(): int from FeedInterface, while preserving the concrete implementation on JsonFileFeed.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main fix: removing FeedInterface::get_entry_count() to stop Stripe Gateway fatals.
Description check ✅ Passed The description clearly matches the change set and explains the compatibility break and the fix.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/feed-interface-bc-break-get-entry-count

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Mayisha Mayisha 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.

Thanks for the quick fix of the backward compatibility issue. The fix looks good and safe to me 👍

@mordeth mordeth added this to the 10.9.0 milestone Jun 24, 2026
@mordeth mordeth merged commit 10c163d into trunk Jun 24, 2026
65 of 69 checks passed
@mordeth mordeth deleted the fix/feed-interface-bc-break-get-entry-count branch June 24, 2026 09:58
@woocommercebot

Copy link
Copy Markdown
Collaborator

IMPORTANT: Merging this PR to the appropriate branches is critical to the release process and ensures that the bug does not cause regressions in the future releases.

Cherry picking was successful for release/10.9. Please merge the following PR: [Backport to release/10.9] Fix fatal error from FeedInterface::get_entry_count() breaking older WooCommerce Stripe Gateway

mordeth added a commit that referenced this pull request Jun 24, 2026
…try_count() breaking older WooCommerce Stripe Gateway (#65972)

Fix fatal error from FeedInterface::get_entry_count() breaking older 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

Co-authored-by: Cvetan Cvetanov <cvetan.cvetanov@automattic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

developer advisory plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants