Commit 10c163d7117 for woocommerce
commit 10c163d711721c2abcb404669e0b6dcd082c10bd
Author: Cvetan Cvetanov <cvetan.cvetanov@automattic.com>
Date: Wed Jun 24 12:57:59 2026 +0300
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
diff --git a/plugins/woocommerce/changelog/fix-feed-interface-bc-break-get-entry-count b/plugins/woocommerce/changelog/fix-feed-interface-bc-break-get-entry-count
new file mode 100644
index 00000000000..aa9d238a1a8
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-feed-interface-bc-break-get-entry-count
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Remove get_entry_count() from the product feed FeedInterface to restore backward compatibility. Requiring the method broke third-party implementations (e.g. older WooCommerce Stripe Gateway versions) that implement the interface without it. The method remains available on JsonFileFeed.
diff --git a/plugins/woocommerce/src/Internal/ProductFeed/Feed/FeedInterface.php b/plugins/woocommerce/src/Internal/ProductFeed/Feed/FeedInterface.php
index 2420874df6f..a363268f650 100644
--- a/plugins/woocommerce/src/Internal/ProductFeed/Feed/FeedInterface.php
+++ b/plugins/woocommerce/src/Internal/ProductFeed/Feed/FeedInterface.php
@@ -51,16 +51,4 @@ interface FeedInterface {
* @return string|null The URL of the feed file, null if not ready.
*/
public function get_file_url(): ?string;
-
- /**
- * Get the number of entries that have been added to the feed.
- *
- * This reflects the rows actually written to the feed, which may be fewer
- * than the number of products iterated by `ProductWalker` because the
- * validator can silently drop entries before they reach `add_entry()`.
- *
- * @since 10.9.0
- * @return int Number of entries added to the feed.
- */
- public function get_entry_count(): int;
}
diff --git a/plugins/woocommerce/src/Internal/ProductFeed/Storage/JsonFileFeed.php b/plugins/woocommerce/src/Internal/ProductFeed/Storage/JsonFileFeed.php
index c5c3209affc..5580df1a75b 100644
--- a/plugins/woocommerce/src/Internal/ProductFeed/Storage/JsonFileFeed.php
+++ b/plugins/woocommerce/src/Internal/ProductFeed/Storage/JsonFileFeed.php
@@ -197,7 +197,14 @@ class JsonFileFeed implements FeedInterface {
}
/**
- * {@inheritDoc}
+ * Get the number of entries that have been added to the feed.
+ *
+ * This reflects the rows actually written to the feed, which may be fewer
+ * than the number of products iterated by `ProductWalker` because the
+ * validator can silently drop entries before they reach `add_entry()`.
+ *
+ * @since 10.9.0
+ * @return int Number of entries added to the feed.
*/
public function get_entry_count(): int {
return $this->entry_count;