WordPress.org

Make WordPress Core

Ticket #46828: 46828.patch

File 46828.patch, 961 bytes (added by thakkarhardik, 4 months ago)

Here is the patch for that resolves this warning. Please let me know if any changes are needed.

  • src/wp-includes/rewrite.php

     
    376376        $compare = '';
    377377        if ( 0 === $postname_index && ( isset( $query_vars['year'] ) || isset( $query_vars['monthnum'] ) ) ) {
    378378                $compare = 'year';
    379         } elseif ( '%year%' === $permastructs[ $postname_index - 1 ] && ( isset( $query_vars['monthnum'] ) || isset( $query_vars['day'] ) ) ) {
     379        } elseif ( ! empty( $postname_index ) && '%year%' === $permastructs[ $postname_index - 1 ] && ( isset( $query_vars['monthnum'] ) || isset( $query_vars['day'] ) ) ) {
    380380                $compare = 'monthnum';
    381         } elseif ( '%monthnum%' === $permastructs[ $postname_index - 1 ] && isset( $query_vars['day'] ) ) {
     381        } elseif ( ! empty( $postname_index ) && '%monthnum%' === $permastructs[ $postname_index - 1 ] && isset( $query_vars['day'] ) ) {
    382382                $compare = 'day';
    383383        }
    384384