Skip to content

Commit

Permalink
Type check for array to fix PHP 8.1 error in content parser
Browse files Browse the repository at this point in the history
  • Loading branch information
alecgeatches committed Sep 10, 2024
1 parent 1593b60 commit d82f06b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/parser/content-parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,11 @@ protected function source_block( WP_Block $block, array $filter_options ) {
];

// WP_Block#inner_blocks can be an array or WP_Block_List (iterable).
$inner_blocks = iterator_to_array( $block->inner_blocks );
if ( is_array( $block->inner_blocks ) ) {
$inner_blocks = $block->inner_blocks;
} else {
$inner_blocks = iterator_to_array( $block->inner_blocks );
}

/**
* Filters a block's inner blocks before recursive iteration.
Expand Down

0 comments on commit d82f06b

Please sign in to comment.