Fix fatal error from FeedInterface::get_entry_count() breaking older WooCommerce Stripe Gateway#65965
Conversation
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 @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:
|
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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthrough
ChangesFeedInterface BC Fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Mayisha
left a comment
There was a problem hiding this comment.
Thanks for the quick fix of the backward compatibility issue. The fix looks good and safe to me 👍
|
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 |
…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>
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
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
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: