[wp-trac] [WordPress Trac] #25834: WP_Date_Query not allowed values possible
WordPress Trac
noreply at wordpress.org
Wed Feb 26 02:44:55 UTC 2014
#25834: WP_Date_Query not allowed values possible
------------------------------------------+------------------
Reporter: ChriCo | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.9
Component: Query | Version: 3.7
Severity: normal | Resolution:
Keywords: needs-patch needs-unit-tests | Focuses:
------------------------------------------+------------------
Comment (by Viper007Bond):
Replying to [comment:13 ChriCo]:
> >What should happen when you pass an out of range date value to a
WP_Query call?
>
> As Toscho ([https://core.trac.wordpress.org/ticket/25834#comment:9])
already said, returning or giving at least an Error-Message (could also
trigger_error() to show a warning when WP_DEBUG is true).
I don't know of any cases right now where `WP_Query` validates input
values and returns an error if you supply an out of bounds value. For
example roll back to version 3.6 and do `WP_Query( array( 'day' => 50 )
)`. Please correct me if I am mistaken though!
Changing the behavior of `WP_Query` to bail on an out of bounds value
would break many things and I think is a very, very bad idea.
In my opinion if `WP_DEBUG` is not enabled, then we should do absolutely
nothing and run the query with the values supplied, as we do today.
However I can certainly see the advantage of throwing a non-blocking error
if and only if `WP_DEBUG` is enabled and I would be in favor of that. It
shouldn't stop the query from being run or anything else, just throw a PHP
error. This could help in figuring out why a query is returning no
results.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/25834#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list