Commit cc05d7406e for woocommerce

commit cc05d7406eaed14355e19d70e3325745e5f113f0
Author: Darren Ethier <darren@roughsmootheng.in>
Date:   Thu Apr 17 13:30:06 2025 -0400

    Add type safety check on callback executing on render_block (#57375)

    * Add type safety check on callback executing on render_block

    Any other extension hooking into `render_block` might return a non string value for $content. This adds some type safety to return early when`$content` is not a string preventing potential fatal errors.

    * add changelog

    ---------

    Co-authored-by: Luigi Teschio <gigitux@gmail.com>

diff --git a/plugins/woocommerce/changelog/fix-type-check-filtered-value-that-could-be-incorrect b/plugins/woocommerce/changelog/fix-type-check-filtered-value-that-could-be-incorrect
new file mode 100644
index 0000000000..0b900249e1
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-type-check-filtered-value-that-could-be-incorrect
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Add type safety check to render_block callback.
diff --git a/plugins/woocommerce/src/Blocks/BlockTypesController.php b/plugins/woocommerce/src/Blocks/BlockTypesController.php
index 05026b51cf..ed881b0596 100644
--- a/plugins/woocommerce/src/Blocks/BlockTypesController.php
+++ b/plugins/woocommerce/src/Blocks/BlockTypesController.php
@@ -284,7 +284,7 @@ final class BlockTypesController {
 	 */
 	public function add_data_attributes( $content, $block ) {

-		if ( ! $this->block_should_have_data_attributes( $block['blockName'] ) ) {
+		if ( ! is_string( $content ) || ! $this->block_should_have_data_attributes( $block['blockName'] ) ) {
 			return $content;
 		}