[wp-trac] [WordPress Trac] #25834: WP_Date_Query not allowed values possible

WordPress Trac noreply at wordpress.org
Tue Nov 5 12:20:04 UTC 2013


#25834: WP_Date_Query not allowed values possible
--------------------------+-----------------------------
 Reporter:  ChriCo        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Date/Time     |    Version:  3.7.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 There are several Parameter-Bugs in the new WP_Date_Query-Class.

 First of all, there is no correct validation of the following Parameters:

 - month / monthnum
 - week / w
 - second
 - minute

 '''Example:'''

 month > 12, week > 52, hour > 23, Minute > 59, Second > 59

 {{{
 $date_query = new WP_Date_Query( array(
   'week'  => 53,
   'month'  => 13,
   'hour'  => 24,
   'minute' => 60,
   'second'  => 59,
   'dayofyear' => 1000,
   'dayofweek' => 10
 ));
 echo $date_query->get_sql();
 /*
 AND (
   ( MONTH( post_date ) = 13
   AND WEEK( post_date, 1 ) = 53
   AND DAYOFYEAR( post_date ) = 1000
   AND DAYOFWEEK( post_date ) = 10
   AND DATE_FORMAT( post_date, '%H.%i%s' ) = 24.605900 )
 )
 */
 }}}

 In the date.php-File Codeblock and
 [http://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters
 Documentation] are also listed the wrong values:

 * minute (int) - Minute (from 0 to 60).
 * second (int) - Second (0 to 60).

 Both of them should be: 0 to 59

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25834>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list