From fb0dcae7e7a31297ebd88d51e971bc2ffb5b5420 Mon Sep 17 00:00:00 2001
From: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
Date: Fri, 27 Apr 2018 20:12:50 -0500
Subject: [PATCH] [#29204] Fix errors about non-static WP_Feed_Cache::create
 invocation

SimplePie requires callbacks to be static functions as it cannot bind to
an instance of a class. There's no problem since the WordPress funtion
`WP_Feed_Cache::create` is a factory method that returns an instance of
`WP_Feed_Cache_Transient`.

This method should be marked as `static` to avoid this error (and
because it makes no sense for it not to be). Unfortunately, SimplePie's
own default cache instance does not have the `static` attribute, and the
function name `create` is hard-coded in SimplePie's `Registry.php`,
meaning that re-declaring `create` as `static` in `WP_Feed_Cache` will
throw an error about "making a non-static method static".

However, there's no need for `WP_Feed_Cache` to actually derive from
`SimplePie_Cache`, as its job is to actually just return an instance of
an object implementing the `SimplePie_Cache_Base` interface, and this is
literally the only call to it in the entire codebase (WP and SimplePie,
both).

Closes #29204.
---
 wp-includes/class-wp-feed-cache.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/wp-includes/class-wp-feed-cache.php b/wp-includes/class-wp-feed-cache.php
index 2564dffb80..aad0143fb1 100644
--- a/wp-includes/class-wp-feed-cache.php
+++ b/wp-includes/class-wp-feed-cache.php
@@ -14,7 +14,7 @@
  *
  * @see SimplePie_Cache
  */
-class WP_Feed_Cache extends SimplePie_Cache {
+class WP_Feed_Cache {
 
 	/**
 	 * Creates a new SimplePie_Cache object.
@@ -26,7 +26,7 @@ class WP_Feed_Cache extends SimplePie_Cache {
 	 * @param string $extension 'spi' or 'spc'.
 	 * @return WP_Feed_Cache_Transient Feed cache handler object that uses transients.
 	 */
-	public function create( $location, $filename, $extension ) {
+	public static function create( $location, $filename, $extension ) {
 		return new WP_Feed_Cache_Transient( $location, $filename, $extension );
 	}
 }
-- 
2.16.1

