Make WordPress Core

Ticket #62627: 62627.patch

File 62627.patch, 1.5 KB (added by ankitkumarshah, 7 months ago)
  • src/wp-includes/class-wp-query.php

    diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php
    index bc673191a8..a6ded6cf1e 100644
    a b class WP_Query { 
    10151015                        $this->is_admin = true;
    10161016                }
    10171017
    1018                 if ( str_contains( $qv['feed'], 'comments-' ) ) {
     1018                if ( is_string( $qv['feed'] ) && str_contains( $qv['feed'], 'comments-' ) ) {
    10191019                        $qv['feed']         = str_replace( 'comments-', '', $qv['feed'] );
    10201020                        $qv['withcomments'] = 1;
    10211021                }
  • src/wp-includes/class-wp.php

    diff --git a/src/wp-includes/class-wp.php b/src/wp-includes/class-wp.php
    index ce88c102cf..c5b2dbb66b 100644
    a b class WP { 
    469469                } else {
    470470                        // Set the correct content type for feeds.
    471471                        $type = $this->query_vars['feed'];
     472
     473                        // Ensure $type is a string
     474                        if ( ! is_string( $type ) ) {
     475                                $type = get_default_feed();
     476                        }
     477
    472478                        if ( 'feed' === $this->query_vars['feed'] ) {
    473479                                $type = get_default_feed();
    474480                        }
    class WP { 
    477483
    478484                        // We're showing a feed, so WP is indeed the only thing that last changed.
    479485                        if ( ! empty( $this->query_vars['withcomments'] )
    480                                 || str_contains( $this->query_vars['feed'], 'comments-' )
     486                                || ( is_string( $this->query_vars['feed'] ) && str_contains( $this->query_vars['feed'], 'comments-' ) )
    481487                                || ( empty( $this->query_vars['withoutcomments'] )
    482488                                        && ( ! empty( $this->query_vars['p'] )
    483489                                                || ! empty( $this->query_vars['name'] )