[wp-trac] [WordPress Trac] #31001: New notices and warnings in WP_Date_Query

WordPress Trac noreply at wordpress.org
Tue Jan 13 14:57:22 UTC 2015


#31001: New notices and warnings in WP_Date_Query
--------------------------+-----------------------------
 Reporter:  dlh           |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  4.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Some parameters of `WP_Date_Query` now generate `Array to string
 conversion` and `_doing_it_wrong()` notices when passed an array.

 For example:

 {{{
 new WP_Query( array(
     'date_query' => array(
         array(
             'compare' => 'BETWEEN',
             'day' => array( 4, 7 ),
         ),
     ),
 ) );
 }}}

 {{{
 new WP_Query( array(
     'date_query' => array(
         array(
             'compare' => 'BETWEEN',
             'dayofweek' => array( 2, 6 ),
         ),
     ),
 ) );
 }}}

 `dayofyear`, `month`, `year`, `week`, and `hour`, `minute`, and `second`
 also generate notices.

 Passing an array to `year` also generates new warnings:

 * `mktime() expects parameter 6 to be long, array given in /wp-
 includes/date.php on line 309`
 * `DateTime::setISODate() expects parameter 1 to be long, array given in
 /wp-includes/date.php on line 342`

 Related: #29822.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31001>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list