From 5b6c00274dbbafde624cfd27c9ba173b3bc324c3 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Sat, 6 Dec 2014 02:28:41 +0000 Subject: [PATCH] Use `wp_checkdate()` when checking date validity in `WP_Date_Query`. See #25834. git-svn-id: https://develop.svn.wordpress.org/trunk@30750 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/date.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/date.php b/src/wp-includes/date.php index fc6c71aff4..9d59866511 100644 --- a/src/wp-includes/date.php +++ b/src/wp-includes/date.php @@ -414,7 +414,7 @@ class WP_Date_Query { if ( $day_exists && $month_exists && $year_exists ) { // 1. Checking day, month, year combination. - if ( ! checkdate( $date_query['month'], $date_query['day'], $date_query['year'] ) ) { + 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'] ) ) ) { /* translators: 1: year, 2: month, 3: day of month */ $day_month_year_error_msg = sprintf( __( 'The following values do not describe a valid date: year %1$s, month %2$s, day %3$s.' ), @@ -431,7 +431,7 @@ class WP_Date_Query { * 2. checking day, month combination * We use 2012 because, as a leap year, it's the most permissive. */ - if ( ! checkdate( $date_query['month'], $date_query['day'], 2012 ) ) { + if ( ! wp_checkdate( $date_query['month'], $date_query['day'], 2012, sprintf( '2012-%s-%s', $date_query['month'], $date_query['day'] ) ) ) { /* translators: 1: month, 2: day of month */ $day_month_year_error_msg = sprintf( __( 'The following values do not describe a valid date: month %1$d, day %2$d.' ),