Make WordPress Core


Ignore:
Timestamp:
08/07/2022 11:03:57 PM (3 years ago)
Author:
peterwilsoncc
Message:

Rewrite rules: Prevent malformed date requests throwing notices.

Ensure that date queries contain each component before attempting to use them. This prevents http requests triggering notices if a portion of the date is missing. For example a request containing a day and year but no month, a request containing a month bu not year.

Props ovidiul, dd32, peterwilsoncc, costdev, johnbillion, SergeyBiryukov, desrosj, tremidkhar, hellofromTonya.
Fixes #52252.

File:
1 edited

Legend:

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

    r52994 r53857  
    411411
    412412    // This is the potentially clashing slug.
    413     $value = $query_vars[ $compare ];
     413    $value = '';
     414    if ( $compare && array_key_exists( $compare, $query_vars ) ) {
     415        $value = $query_vars[ $compare ];
     416    }
    414417
    415418    $post = get_page_by_path( $value, OBJECT, 'post' );
Note: See TracChangeset for help on using the changeset viewer.