Changeset 62047
- Timestamp:
- 03/18/2026 09:02:09 PM (9 days ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-includes/class-wp-query.php (modified) (1 diff)
-
tests/phpunit/tests/query/parseQuery.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-query.php
r61878 r62047 1190 1190 ); 1191 1191 1192 if ( ! empty( $t->rewrite['hierarchical'] ) ) {1192 if ( is_string( $query_vars[ $t->query_var ] ) && ! empty( $t->rewrite['hierarchical'] ) ) { 1193 1193 $query_vars[ $t->query_var ] = wp_basename( $query_vars[ $t->query_var ] ); 1194 1194 } -
trunk/tests/phpunit/tests/query/parseQuery.php
r59766 r62047 234 234 $this->assertEmpty( $q->query_vars['attachment_id'] ); 235 235 } 236 237 /** 238 * Tests that a fatal error is not thrown when a hierarchical taxonomy query var 239 * passed to wp_basename() in ::parse_tax_query() is an array instead of a string. 240 * 241 * The message that we should not see: 242 * `TypeError: urldecode(): Argument #1 ($string) must be of type string, array given`. 243 * 244 * @ticket 64870 245 */ 246 public function test_parse_query_hierarchical_taxonomy_query_var_array() { 247 register_taxonomy( 248 'wptests_tax', 249 'post', 250 array( 251 'query_var' => 'wptests_tax', 252 'rewrite' => array( 'hierarchical' => true ), 253 'public' => true, 254 ) 255 ); 256 257 $q = new WP_Query( 258 array( 259 'wptests_tax' => array( 'term-a', 'term-b' ), 260 ) 261 ); 262 263 unregister_taxonomy( 'wptests_tax' ); 264 265 $this->assertIsArray( $q->posts ); 266 } 236 267 }
Note: See TracChangeset
for help on using the changeset viewer.