Make WordPress Core

Changeset 61551

Timestamp:
01/28/2026 10:42:10 PM (5 weeks ago)
Author:
peterwilsoncc
Message:

Feeds: Fix backward compatibility of fetch_feed().

In simplepie/simplepie#795 handling of multiple feed requests was deprecated, triggering the message Fetching multiple feeds with single SimplePie instance is deprecated since SimplePie 1.9.0, create one SimplePie instance per feed and use SimplePie::merge_items to get a single list of items.

This updates fetch_feed() to handle multiple requests using seperate SimplePie instances in order to retain backward compatibility.

A PHP 8.5 deprecation was throwing notices in the event an empty URL was passed to fetch_feed(), Using null as an array offset is deprecated, use an empty string instead.

This includes a workaround pending the release of a SimplePie version including simplepie/simplepie#949.

Fixes #64136.
Props audrasjb, jorbin, muryam, oglekler, ozgursar, presskopp, swissspidy, westonruter, wildworks, peterwilsoncc.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/feed.php

    r60771 r61551  
    833833    $feed->get_registry()->register( SimplePie\File::class, 'WP_SimplePie_File', true );
    834834
    835     $feed->set_feed_url( $url );
    836835    /** This filter is documented in wp-includes/class-wp-feed-cache-transient.php */
    837836    $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) );
     
    847846    do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );
    848847
     848
     849
     850
     851
     852
     853
     854
     855
     856
     857
     858
     859
     860
     861
     862
     863
     864
     865
     866
     867
     868
     869
     870
     871
     872
     873
     874
     875
     876
     877
     878
     879
     880
     881
     882
     883
     884
     885
     886
     887
     888
     889
     890
     891
     892
     893
     894
     895
     896
     897
     898
     899
     900
     901
    849902    $feed->init();
    850903    $feed->set_output_encoding( get_bloginfo( 'charset' ) );
  • trunk/tests/phpunit/tests/feed/fetchFeed.php

    r61413 r61551  
    3535
    3636    /**
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
     125
     126
     127
     128
     129
     130
     131
     132
     133
     134
     135
     136
     137
     138
     139
    37140     * Ensure that fetch_feed() is cached on second and subsequent calls.
    38141     *
     
    112215        );
    113216    }
     217
     218
     219
     220
     221
     222
     223
     224
     225
     226
     227
     228
     229
     230
     231
     232
     233
     234
     235
     236
    114237}
Note: See TracChangeset for help on using the changeset viewer.