mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Don't bail out of term_exists() when term sanitizes to an empty string.
This change brings return values for failures of this sort in line with other failed lookups in term_exists(): a null value is now returned in all cases where the queried term is not found. Adds unit test for the sanitization issue. Modifies existing unit test to reflect the change in return value for empty term strings. Props boonebgorges, georgestephanis. Fixes #29589. git-svn-id: https://develop.svn.wordpress.org/trunk@29865 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -112,7 +112,20 @@ class Tests_Term extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_term_exists_term_trimmed_to_empty_string() {
|
||||
$this->assertSame( 0, term_exists( ' ' ) );
|
||||
$this->assertNull( term_exists( ' ' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 29589
|
||||
*/
|
||||
public function test_term_exists_existing_term_that_sanitizes_to_empty() {
|
||||
wp_insert_term( '//', 'category' );
|
||||
$this->assertNotEmpty( term_exists( '//' ) );
|
||||
$this->assertNotEmpty( term_exists( '//', 'category' ) );
|
||||
|
||||
wp_insert_term( '>>', 'category' );
|
||||
$this->assertNotEmpty( term_exists( '>>' ) );
|
||||
$this->assertNotEmpty( term_exists( '>>', 'category' ) );
|
||||
}
|
||||
|
||||
public function test_term_exists_taxonomy_nonempty_parent_nonempty_match_slug() {
|
||||
|
||||
Reference in New Issue
Block a user