Feeds: Register transient feed cache handler using the recommended method for SimplePie 1.3 or later.
This fixes a "Non-static method cannot be called statically" fatal error when calling `fetch_feed()` on PHP 8. Follow-up to [21644], [21652], [22366], [22599]. Props dd32, afragen, Senning, markoheijnen, ComputerGuru, useStrict, Ipstenu, nacin, l3rady, HoaSi, NathanAtmoz, fabifott, jfoulquier, thefarlilacfield, subscriptiongroup, rogerlos, Mte90, mopsyd, dossy, stulab, MadtownLems, roikles, justlevine, joostdevalk, OptimizingMatters, hellofromTonya, bph, ayeshrajans, SergeyBiryukov. Fixes #29204. Built from https://develop.svn.wordpress.org/trunk@49565 git-svn-id: http://core.svn.wordpress.org/trunk@49303 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9c6f41419c
commit
4446e597a7
|
@ -5,8 +5,16 @@
|
|||
* @package WordPress
|
||||
* @subpackage Feed
|
||||
* @since 4.7.0
|
||||
* @deprecated 5.6.0
|
||||
*/
|
||||
|
||||
_deprecated_file(
|
||||
basename( __FILE__ ),
|
||||
'5.6.0',
|
||||
'',
|
||||
__( 'This file is only loaded for backward compatibility with SimplePie 1.2.x. Please consider switching to a recent SimplePie version.' )
|
||||
);
|
||||
|
||||
/**
|
||||
* Core class used to implement a feed cache.
|
||||
*
|
||||
|
|
|
@ -789,7 +789,6 @@ function fetch_feed( $url ) {
|
|||
require_once ABSPATH . WPINC . '/class-simplepie.php';
|
||||
}
|
||||
|
||||
require_once ABSPATH . WPINC . '/class-wp-feed-cache.php';
|
||||
require_once ABSPATH . WPINC . '/class-wp-feed-cache-transient.php';
|
||||
require_once ABSPATH . WPINC . '/class-wp-simplepie-file.php';
|
||||
require_once ABSPATH . WPINC . '/class-wp-simplepie-sanitize-kses.php';
|
||||
|
@ -801,7 +800,16 @@ function fetch_feed( $url ) {
|
|||
// constructor sets it before we have a chance to set the sanitization class.
|
||||
$feed->sanitize = new WP_SimplePie_Sanitize_KSES();
|
||||
|
||||
$feed->set_cache_class( 'WP_Feed_Cache' );
|
||||
// Register the cache handler using the recommended method for SimplePie 1.3 or later.
|
||||
if ( method_exists( 'SimplePie_Cache', 'register' ) ) {
|
||||
SimplePie_Cache::register( 'wp_transient', 'WP_Feed_Cache_Transient' );
|
||||
$feed->set_cache_location( 'wp_transient' );
|
||||
} else {
|
||||
// Back-compat for SimplePie 1.2.x.
|
||||
require_once ABSPATH . WPINC . '/class-wp-feed-cache.php';
|
||||
$feed->set_cache_class( 'WP_Feed_Cache' );
|
||||
}
|
||||
|
||||
$feed->set_file_class( 'WP_SimplePie_File' );
|
||||
|
||||
$feed->set_feed_url( $url );
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.6-beta3-49564';
|
||||
$wp_version = '5.6-beta3-49565';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue