[wp-trac] [WordPress Trac] #34533: Term splitting in `get_term()` can have unexpected effects
WordPress Trac
noreply at wordpress.org
Thu Nov 5 15:04:03 UTC 2015
#34533: Term splitting in `get_term()` can have unexpected effects
--------------------------+---------------------------
Reporter: dlh | Owner: boonebgorges
Type: defect (bug) | Status: assigned
Priority: high | Milestone: 4.4
Component: Taxonomy | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+---------------------------
Comment (by dlh):
On term-splitting, 34533.2 makes sense to me. I'm not as familiar with the
current approaches to caching terms in core, so others are probably
better-suited to comment about those changes.
One other potential issue is that `get_term( $term_id )` could get a term
from an invalid taxonomy. Here's a test that fails with the patch:
{{{#!php
public function
test_get_term_with_only_id_is_error_when_invalid_taxonomy() {
global $wp_taxonomies;
$t = self::factory()->term->create( array( 'taxonomy' =>
'wptests_tax' ) );
$this->assertInstanceOf( 'WP_Term', get_term( $t ) );
// "Unregister" the taxonomy.
unset( $wp_taxonomies['wptests_tax'] );
// Test when the term would come from the cache or the DB.
$this->assertNotInstanceOf( 'WP_Term', get_term( $t ) );
clean_term_cache( $t, 'terms' );
$this->assertNotInstanceOf( 'WP_Term', get_term( $t ) );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34533#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list