[wp-trac] [WordPress Trac] #51956: Fatal error with PHP8 in header link RSS feed on dashboard widget

WordPress Trac noreply at wordpress.org
Tue Dec 8 15:38:12 UTC 2020


#51956: Fatal error with PHP8 in header link RSS feed on dashboard widget
----------------------------+-----------------------
 Reporter:  NicolasKulka    |       Owner:  (none)
     Type:  defect (bug)    |      Status:  assigned
 Priority:  high            |   Milestone:  5.6.1
Component:  Widgets         |     Version:
 Severity:  critical        |  Resolution:
 Keywords:  php8 has-patch  |     Focuses:  rest-api
----------------------------+-----------------------

Comment (by iandunn):

 This may be a duplicate after all.

 I've always had lots of problems with the #43055 build tool, and got
 frustrated enough yesterday that I tried out the #44492 method again. Now
 that I'm running directly from `src/`,
 [https://core.trac.wordpress.org/attachment/ticket/51056/51056.diff
 51056.diff] '''does''' fix this for me.

 @hellofromtonya, @SergeyBiryukov, I'm wondering if that could have been
 part of the reason the patch didn't work for you either? See #51960 for
 some details.

 Another reason might be because the transients were cached?

 Here's the mu-plugins I'm using to make these easier to test. They
 effectively prevent the feeds from being cached, so you don't have to
 manually delete the transients. (You'll still have to delete any existing
 ones before running this, though).

 `51056.php`:
 {{{#!php
 <?php

 // don't cache results, so can easily test changes
 add_filter( 'wp_feed_cache_transient_lifetime', function() {
         return 1;
 } );

 add_action( 'template_redirect', function() {
         // it only happens on some feeds, isolate which ones and figure
 out why
         $urls = array(
                 // these are fine
                 'https://wordpress.org/news/category/releases/feed/',
                 'https://iandunn.name/tag/z/feed/',
                 'https://wptavern.com/2020/12/feed/',
                 'https://heropress.com/feed/',

                 // these cause errors, b/c they have multiple 'Link'
 headers
                 'https://www.wpserveur.net/securite-wps/feed/',
         );

         foreach ( $urls as $url ) {
                 $feed = fetch_feed( $url );

                 $items = $feed->get_items( 0, 2 );

                 foreach ( $items as $item ) {
                         echo $item->get_permalink() . "\n";
                 }
         }

         wp_die(__FILE__);
 } );
 }}}

 `51956.php`:

 {{{#!php
 <?php

 // don't cache results, so can easily test changes
 add_filter( 'wp_feed_cache_transient_lifetime', function() {
         return 1;
 } );

 add_action( 'wp_dashboard_setup', 'add_dashboard_widget_wpsecu' );

 function add_dashboard_widget_wpsecu() {
         wp_add_dashboard_widget( 'dashboard_widget_wpsecu', __( 'Sécurité
 de WordPress' ), 'dashboard_widget_function_secu' );
 }

 function dashboard_widget_function_secu() {
         $feeds = array(
                 'news'   => array(
                         // should get fatal w/ these b/c category
                         'link'         => 'https://www.wpserveur.net
 /securite-wps/',
                         'url'          => 'https://www.wpserveur.net
 /securite-wps/feed/',

                         // shouldn't get fatal w/ these b/c not category
 //                      'link'         => 'https://www.wpserveur.net/',
 //                      'url'          =>
 'https://www.wpserveur.net/feed/',

                         'title'        => apply_filters(
 'dashboard_primary_title', __( 'WordPress Blog' ) ),
                         'items'        => 2,
                         'show_summary' => 0,
                         'show_author'  => 0,
                         'show_date'    => 0,
                 ),
         );

         wp_dashboard_primary_output( 'dashboard_widget_wpsecu', $feeds );
 }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51956#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list