[wp-trac] [WordPress Trac] #35808: get_term() possible PHP fatal error
WordPress Trac
noreply at wordpress.org
Fri Feb 12 11:06:57 UTC 2016
#35808: get_term() possible PHP fatal error
-------------------------------------------------+-------------------------
Reporter: tmuikku | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting
Component: General | Review
Severity: normal | Version: trunk
Focuses: ui, template, multisite, | Keywords:
performance |
-------------------------------------------------+-------------------------
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 );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35808>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list