[wp-trac] [WordPress Trac] #63255: WP_Query normalization can break plugin filters comparing query variables.
WordPress Trac
noreply at wordpress.org
Fri Apr 11 16:22:19 UTC 2025
#63255: WP_Query normalization can break plugin filters comparing query variables.
--------------------------------------+------------------------
Reporter: peterwilsoncc | Owner: joemcgill
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: 6.8.1
Component: Query | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+------------------------
Comment (by johnjamesjacoby):
@joemcgill I checked out the link—while bbPress is the only plugin using
that specific strict comparison, I noticed other plugins are doing similar
get/set operations on post_type. That seems to support the broader point I
was trying to make about plugins generally not accounting for array sort
order.
For instance, Jetpack appends the comics post type without re-sorting:
https://wpdirectory.net/search/01JRJGRVBBT7Y5FWV4ZP833G67
It looks like this could open the door to similar shared-state issues
across other WP_Query arguments that involve order-sensitive arrays (like
post_status, etc.)
A more fault-tolerant approach might be to handle normalization in some
isolated way that is not directly exposed to hooks.
One option could even be normalizing a copy/stub of the main WP_Query
object, so the original values remain untouched.
I get the concern about reacting to breakage reports for 6.8.1, and that’s
totally valid. I just still have some reservations about whether this
particular solution is the most robust in the long term.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63255#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list