From 0e27fdcc47dc8883ee73148e0ee7965091f8799b Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Fri, 12 Feb 2016 14:26:27 +0000 Subject: [PATCH] Bail from `get_term()` if a filter returns an object that is not a `WP_Term`. This prevents fatal errors in certain cases. Props tmuikku. Fixes #35808. Built from https://develop.svn.wordpress.org/trunk@36516 git-svn-id: http://core.svn.wordpress.org/trunk@36483 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy.php | 5 +++++ wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index ce01f1771a..4d672564ef 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -857,6 +857,11 @@ function get_term( $term, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) { */ $_term = apply_filters( "get_$taxonomy", $_term, $taxonomy ); + // Bail if a filter callback has changed the type of the `$_term` object. + if ( ! ( $_term instanceof WP_Term ) ) { + return $_term; + } + // Sanitize term, according to the specified filter. $_term->filter( $filter ); diff --git a/wp-includes/version.php b/wp-includes/version.php index ef2394803c..8e66172df4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36515'; +$wp_version = '4.5-alpha-36516'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.