[wp-trac] [WordPress Trac] #17093: Validation and context parameter for query filter application
WordPress Trac
wp-trac at lists.automattic.com
Sat Apr 9 14:49:00 UTC 2011
#17093: Validation and context parameter for query filter application
-------------------------+------------------------------
Reporter: kevinB | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version:
Severity: normal | Resolution:
Keywords: has-patch |
-------------------------+------------------------------
Comment (by kevinB):
Replying to [comment:3 nacin]:
> I'm not sure, in terms of processing, how this is much different from a
callback checking context on their own. I could imagine many use cases
would be to do different things on different contexts. I think better
effort would be spent tagging every query in core with a context, than to
come up with a new (and strict) API.
>
We're in agreement on tagging core queries with a context. Do I hear a
task blessing there?
Agreed that context checking by the caller is a lesser concern. But if you
look at it in terms of risk mitigation or damage control, a filter added
with a specified context is immediately safer. If the added overhead is
minimal, isn't that better for everyone? Otherwise every query in the
request depends on the callback's successful returning of an unfiltered
value in its out-of-context executions - doable but often unnecessary.
If strictness is a concern, context could be implemented as an array to
let filters specify multiple contexts. And filters are always free to
implement their own context check by leaving it unspecified.
Anyway, I thought the null validation issue might be compelling enough to
bring caller-side context checking in on its coattails :)
--
Ticket URL: <http://core.trac.wordpress.org/ticket/17093#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list