Opened 10 years ago
Closed 10 years ago
#35808 closed defect (bug) (fixed)
get_term() possible PHP fatal error
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.5 | Priority: | normal |
| Severity: | normal | Version: | 4.4 |
| Component: | General | Keywords: | |
| Focuses: | ui, template, multisite, performance | Cc: |
Description
I noticed occasional fatal error from get_term() function when a get_term filter or get_{$taxonomy} filter returns something else than WP_Term object.
In my case it is WPML in a rare multisite scenario causing this, but nevertheless it would be good to do another check if $_term is indeed a WP_Term before the filter method call in wp-includes/taxonomy.php line ~800.
...
$_term = apply_filters( 'get_term', $_term, $taxonomy );
...
$_term = apply_filters( "get_$taxonomy", $_term, $taxonomy );
// Maybe check here if the filters returned error
if ( is_wp_error( $_term ) ) {
return $_term;
} elseif ( ! $_term ) {
return null;
}
// Sanitize term, according to the specified filter.
$_term->filter( $filter );
Change History (2)
Note: See
TracTickets for help on using
tickets.
Hi @tmuikku - Thanks for the report, and welcome to WordPress Trac! This looks like a legitimate issue.