Changeset 54785
- Timestamp:
- 11/10/2022 02:59:56 AM (16 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/canonical.php
r53043 r54785 332 332 333 333 foreach ( $wp_query->tax_query->queried_terms as $tax_query ) { 334 $term_count += count( $tax_query['terms'] ); 334 if ( isset( $tax_query['terms'] ) && is_countable( $tax_query['terms'] ) ) { 335 $term_count += count( $tax_query['terms'] ); 336 } 335 337 } 336 338 -
trunk/tests/phpunit/tests/canonical.php
r53043 r54785 376 376 delete_option( 'page_on_front' ); 377 377 } 378 379 /** 380 * Ensure NOT EXISTS queries do not trigger not-countable or undefined array key errors. 381 * 382 * @ticket 55955 383 */ 384 public function test_feed_canonical_with_not_exists_query() { 385 // Set a NOT EXISTS tax_query on the global query. 386 $global_query = $GLOBALS['wp_query']; 387 $GLOBALS['wp_query'] = new WP_Query( 388 array( 389 'post_type' => 'post', 390 'tax_query' => array( 391 array( 392 'taxonomy' => 'post_format', 393 'operator' => 'NOT EXISTS', 394 ), 395 ), 396 ) 397 ); 398 399 $url = redirect_canonical( get_term_feed_link( self::$terms['/category/parent/'] ), false ); 400 // Restore original global. 401 $GLOBALS['wp_query'] = $global_query; 402 403 $this->assertNull( $url ); 404 } 378 405 }
Note: See TracChangeset
for help on using the changeset viewer.