Changeset 53869
- Timestamp:
- 08/09/2022 10:21:32 AM (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy.php
r53827 r53869 338 338 global $wp_taxonomies; 339 339 340 return is set( $wp_taxonomies[ $taxonomy ] );340 return is_string( $taxonomy ) && isset( $wp_taxonomies[ $taxonomy ] ); 341 341 } 342 342 -
trunk/tests/phpunit/tests/taxonomy.php
r53669 r53869 129 129 } 130 130 131 /** 132 * Tests that `taxonomy_exists()` returns `false` when the `$taxonomy` 133 * argument is not a string. 134 * 135 * @ticket 56338 136 * 137 * @covers :taxonomy_exists 138 * 139 * @dataProvider data_taxonomy_exists_should_return_false_with_non_string_taxonomy 140 * 141 * @param mixed $taxonomy The non-string taxonomy. 142 */ 143 public function test_taxonomy_exists_should_return_false_with_non_string_taxonomy( $taxonomy ) { 144 $this->assertFalse( taxonomy_exists( $taxonomy ) ); 145 } 146 147 /** 148 * Data provider with non-string values. 149 * 150 * @return array 151 */ 152 public function data_taxonomy_exists_should_return_false_with_non_string_taxonomy() { 153 return array( 154 'array' => array( array() ), 155 'object' => array( new stdClass() ), 156 'bool (true)' => array( true ), 157 'bool (false)' => array( false ), 158 'null' => array( null ), 159 'integer (0)' => array( 0 ), 160 'integer (1)' => array( 1 ), 161 'float (0.0)' => array( 0.0 ), 162 'float (1.1)' => array( 1.1 ), 163 ); 164 } 165 131 166 public function test_is_taxonomy_hierarchical() { 132 167 $this->assertTrue( is_taxonomy_hierarchical( 'category' ) );
Note: See TracChangeset
for help on using the changeset viewer.