Opened 9 years ago
Last modified 9 years ago
#41196 new defect (bug)
add _doing_it_wrong to get_query_var and prevent fatal errors
| Reported by: | netweblogic | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Query | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
The following scenario will throw a fatal error:
<?php function parse_query_fail_test(){ get_query_var('some_var_name', false); } add_action('parse_query', 'parse_query_fail_test'); function parse_query_fail_trigger(){ get_posts(); } add_action('plugins_loaded', 'parse_query_fail_trigger');
this could easily be avoided with a check and _doing_it_wrong function, similar to functions further down such as is_tax();
I would argue that the same could be done for get_queried_object(), get_queried_object_id() and set_query_var()
Attachments (2)
Change History (3)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Suggested patch for get_query_var