Make WordPress Core

Changeset 30750


Ignore:
Timestamp:
12/06/2014 02:28:41 AM (11 years ago)
Author:
boonebgorges
Message:

Use wp_checkdate() when checking date validity in WP_Date_Query.

See #25834.

File:
1 edited

Legend:

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

    r30681 r30750  
    415415        if ( $day_exists && $month_exists && $year_exists ) {
    416416            // 1. Checking day, month, year combination.
    417             if ( ! checkdate( $date_query['month'], $date_query['day'], $date_query['year'] ) ) {
     417            if ( ! wp_checkdate( $date_query['month'], $date_query['day'], $date_query['year'], sprintf( '%s-%s-%s', $date_query['year'], $date_query['month'], $date_query['day'] ) ) ) {
    418418                /* translators: 1: year, 2: month, 3: day of month */
    419419                $day_month_year_error_msg = sprintf(
     
    432432             * We use 2012 because, as a leap year, it's the most permissive.
    433433             */
    434             if ( ! checkdate( $date_query['month'], $date_query['day'], 2012 ) ) {
     434            if ( ! wp_checkdate( $date_query['month'], $date_query['day'], 2012, sprintf( '2012-%s-%s', $date_query['month'], $date_query['day'] ) ) ) {
    435435                /* translators: 1: month, 2: day of month */
    436436                $day_month_year_error_msg = sprintf(
Note: See TracChangeset for help on using the changeset viewer.