[wp-trac] [WordPress Trac] #31083: WP_date_Query does not validate string values of 'before' or 'after' (was: WP_date_Query - broken before/after validation)
WordPress Trac
noreply at wordpress.org
Wed Jan 21 12:37:29 UTC 2015
#31083: WP_date_Query does not validate string values of 'before' or 'after'
-------------------------+-----------------------------
Reporter: ChriCo | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Query | Version: 4.1
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
-------------------------+-----------------------------
Changes (by boonebgorges):
* keywords: => needs-patch
* type: defect (bug) => enhancement
* milestone: Awaiting Review => Future Release
Comment:
Thanks for the patch. I'm changing the ticket summary because it's not
really "broken", it was just skipped for non-array values of 'before' and
'after'. I don't really recall the reasons for this.
Regarding the patch, I'd like to see the logic consolidated. Let's either
move the string parsing into `validate_date_values()`, or have a separate
method for parsing string dates only, which is called when a string value
is detected. It also looks like passing the UNIX epoch will result in an
invalid notice, which is incorrect - the `! ! strtotime()` check will have
to be something more fine-grained. And we can't remove the `is_numeric()`
check introduced in [31251], or string values for 'hour' will not be
properly rejected.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31083#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list