[wp-trac] [WordPress Trac] #59235: AJAX request returns critical error in class-wp-date-query.php

WordPress Trac noreply at wordpress.org
Tue Aug 29 13:12:29 UTC 2023


#59235: AJAX request returns critical error in class-wp-date-query.php
--------------------------+--------------------------------
 Reporter:  reklwera      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  php-compatibility
--------------------------+--------------------------------

Comment (by jrf):

 @reklwera Thanks for reporting this and welcome to Trac.

 Primarily this is a case of incorrect input being passed to the date
 query, so this needs a backtrace and should be solved at the point where
 the incorrect data is being passed.

 The `year` key for the `DateQuery` class is
 [https://developer.wordpress.org/reference/classes/wp_date_query/__construct/
 explicitly documented] as only accepting `int` or and array of `int`
 values, while the error indicates that a string or and array of strings
 was passed.

 So, based on this, the patch provided on GitHub is invalid as this is not
 the right way to solve this. We could consider it, but in that case, I
 would want calls to `_doing_it_wrong()` to be added as well as the data
 should be called out as invalid to give the dev the chance to fix it.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59235#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list