[Backport to release/10.9] Fix fatal error from FeedInterface::get_entry_count() breaking older WooCommerce Stripe Gateway#65972
Conversation
…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
Testing GuidelinesHi @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:
|
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. 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. |
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(): intas a required method onFeedInterface(shipped in 10.9.0). Because that interface is implemented by third-party code — notably the WooCommerce Stripe Gateway'sWC_Stripe_Agentic_Commerce_Csv_Feed— adding a required method is a backward-incompatible change. Stripe Gateway versions that predate their ownget_entry_count()implementation (added in Stripe 10.7) fatal on load under 10.9.0: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 concreteJsonFileFeed, 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 onJsonFileFeedintact.Bug introduced in PR #64394.
How to test the changes in this Pull Request:
get_entry_count()was added (Stripe < 10.7), so itsWC_Stripe_Agentic_Commerce_Csv_FeedimplementsFeedInterfacewithoutget_entry_count().trunkbefore this change, activate both WooCommerce and that Stripe Gateway version (orrequirethe feed class) and confirm the fatal error above is raised.pnpm --filter=@woocommerce/plugin-woocommerce test:php:env -- --filter 'JsonFileFeedTest|ProductWalkerTest'passes (19 tests / 453 assertions), includingJsonFileFeed::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
Automatically assign milestone for the next WooCommerce versionChangelog 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
Type
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: