Make WordPress Core

Ticket #29204: 0001-29204-Fix-errors-about-non-static-WP_Feed_Cache-crea.patch

File 0001-29204-Fix-errors-about-non-static-WP_Feed_Cache-crea.patch, 1.3 KB (added by ComputerGuru, 7 years ago)

Updated patch for error

  • wp-includes/class-wp-feed-cache.php

    From 2530773b1276dfcf6adcfa67fa8b0614af1a09ac 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).
    
    Closes #29204.
    ---
     wp-includes/class-wp-feed-cache.php | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/wp-includes/class-wp-feed-cache.php b/wp-includes/class-wp-feed-cache.php
    index 2564dffb80..e1ae22553a 100644
    a b class WP_Feed_Cache extends SimplePie_Cache { 
    2626         * @param string $extension 'spi' or 'spc'.
    2727         * @return WP_Feed_Cache_Transient Feed cache handler object that uses transients.
    2828         */
    29         public function create( $location, $filename, $extension ) {
     29        public static function create( $location, $filename, $extension ) {
    3030                return new WP_Feed_Cache_Transient( $location, $filename, $extension );
    3131        }
    3232}