Making WordPress.org


Ignore:
Timestamp:
04/20/2020 07:53:13 AM (4 years ago)
Author:
dd32
Message:

Plugin Directory: Avoid a PHP Notice when a plugins readme contains a section that has no content in it, and that section is the last in the readme.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin.php

    r9141 r9747  
    141141        $_pages = preg_split( '#<!--section=(.+?)-->#', $post->post_content, - 1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
    142142        for ( $i = 0; $i < count( $_pages ); $i += 2 ) {
    143             $result['sections'][ $_pages[ $i ] ] = apply_filters( 'the_content', $_pages[ $i + 1 ], $_pages[ $i ] );
     143            $result['sections'][ $_pages[ $i ] ] = apply_filters( 'the_content', $_pages[ $i + 1 ] ?? '', $_pages[ $i ] );
    144144        }
    145145        $result['sections']['screenshots'] = ''; // placeholder to put screenshots prior to reviews at the end.
Note: See TracChangeset for help on using the changeset viewer.