From 4dede2fb58503c73b667be542a5a01f480a75510 Mon Sep 17 00:00:00 2001
From: Carlos Bravo <carlos.bravo@automattic.com>
Date: Fri, 2 Feb 2024 16:56:19 +0100
Subject: [PATCH] Revert "Avoid not needed serialization"

This reverts commit 78daef1185373c7153f060f580427d0331caa57e.
---
 .../wordpress-6.5/interactivity-api/interactivity-api.php   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/compat/wordpress-6.5/interactivity-api/interactivity-api.php b/lib/compat/wordpress-6.5/interactivity-api/interactivity-api.php
index 7b6fcc9c06fd2c..32900a78f6d691 100644
--- a/lib/compat/wordpress-6.5/interactivity-api/interactivity-api.php
+++ b/lib/compat/wordpress-6.5/interactivity-api/interactivity-api.php
@@ -37,7 +37,7 @@ function wp_interactivity_process_directives_of_interactive_blocks( $parsed_bloc
 				( isset( $block_type->supports['interactivity']['interactive'] ) && true === $block_type->supports['interactivity']['interactive'] ) )
 			) {
 				// Annotates the root interactive block for processing.
-				$root_interactive_block = array( $block_name, $parsed_block );
+				$root_interactive_block = array( $block_name, md5( serialize( $parsed_block ) ) );
 
 				/*
 				 * Adds a filter to process the root interactive block once it has
@@ -45,8 +45,8 @@ function wp_interactivity_process_directives_of_interactive_blocks( $parsed_bloc
 				 */
 				$process_interactive_blocks = static function ( $content, $parsed_block ) use ( &$root_interactive_block, &$process_interactive_blocks ) {
 					// Checks whether the current block is the root interactive block.
-					list( $root_block_name, $root_parsed_block ) = $root_interactive_block;
-					if ( $root_block_name === $parsed_block['blockName'] && $parsed_block === $root_parsed_block ) {
+					list($root_block_name, $root_block_md5) = $root_interactive_block;
+					if ( $root_block_name === $parsed_block['blockName'] && md5( serialize( $parsed_block ) ) === $root_block_md5 ) {
 						// The root interactive blocks has finished rendering, process it.
 						$content = wp_interactivity_process_directives( $content );
 						// Removes the filter and reset the root interactive block.