From 9d54dd69d2e179a77b2e671b45a597c0dc3b6024 Mon Sep 17 00:00:00 2001
From: Bernie Reiter <ockham@raz.or.at>
Date: Tue, 28 May 2024 17:23:13 +0200
Subject: [PATCH] Remove fallback mechanism

---
 src/wp-includes/blocks.php                    |  5 ---
 .../tests/blocks/getActiveBlockVariation.php  | 45 -------------------
 2 files changed, 50 deletions(-)

diff --git a/src/wp-includes/blocks.php b/src/wp-includes/blocks.php
index be95dda421e6f..fc986a74c4b85 100644
--- a/src/wp-includes/blocks.php
+++ b/src/wp-includes/blocks.php
@@ -2364,9 +2364,6 @@ function _wp_footnotes_force_filtered_html_on_import_filter( $arg ) {
  * block attribute keys that are compared to the given block's attributes using
  * a strict equality check.
  *
- * If no `isActive` property is defined, all `attributes` specified by a variation
- * are compared to the given block's to determine if the variation is active.
- *
  * @param WP_Block_Type $block_type       Block Type.
  * @param array         $block_attributes Block attributes.
  * @return array|null The active block variation, or null if no active variation is found.
@@ -2379,8 +2376,6 @@ function get_active_block_variation( $block_type, $block_attributes ) {
 			! empty( $variation['isActive'] )
 		) {
 			$attributes = $variation['isActive'];
-		} else if ( isset( $variation['attributes'] ) ) {
-			$attributes = array_keys( $variation['attributes'] );
 		} else {
 			// We have no way to determine if this is the active variation.
 			continue;
diff --git a/tests/phpunit/tests/blocks/getActiveBlockVariation.php b/tests/phpunit/tests/blocks/getActiveBlockVariation.php
index a985a0d747679..32371695972a5 100644
--- a/tests/phpunit/tests/blocks/getActiveBlockVariation.php
+++ b/tests/phpunit/tests/blocks/getActiveBlockVariation.php
@@ -67,34 +67,6 @@ public function test_get_active_block_variation_match_with_is_active() {
 		$this->assertSame( 'variation_with_is_active', $active_variation['name'] );
 	}
 
-	/**
-	 * @ticket 61265
-	 */
-	public function test_get_active_block_variation_match_with_empty_is_active() {
-		$block_attributes = array(
-			'attribute1' => 'var2-attr1',
-			'attribute2' => 'var2-attr2',
-			'attribute3' => 'var2-attr3',
-		);
-
-		$active_variation = get_active_block_variation( self::$block_type, $block_attributes );
-		$this->assertSame( 'variation_with_empty_is_active', $active_variation['name'] );
-	}
-
-	/**
-	 * @ticket 61265
-	 */
-	public function test_get_active_block_variation_match_without_is_active() {
-		$block_attributes = array(
-			'attribute1' => 'var3-attr1',
-			'attribute2' => 'var3-attr2',
-			'attribute3' => 'var3-attr3',
-		);
-
-		$active_variation = get_active_block_variation( self::$block_type, $block_attributes );
-		$this->assertSame( 'variation_without_is_active', $active_variation['name'] );
-	}
-
 	/**
 	 * Mock variation callback.
 	 *
@@ -114,23 +86,6 @@ public static function mock_variation_callback() {
 					'attribute3',
 				),
 			),
-			array(
-				'name'       => 'variation_with_empty_is_active',
-				'attributes' => array(
-					'attribute1' => 'var2-attr1',
-					'attribute2' => 'var2-attr2',
-					'attribute3' => 'var2-attr3',
-				),
-				'isActive'   => array(),
-			),
-			array(
-				'name'       => 'variation_without_is_active',
-				'attributes' => array(
-					'attribute1' => 'var3-attr1',
-					'attribute2' => 'var3-attr2',
-					'attribute3' => 'var3-attr3',
-				),
-			),
 		);
 	}
 }