Skip to content

Commit

Permalink
Merge pull request #78 from Automattic/fix/php-8.1-iterator-error
Browse files Browse the repository at this point in the history
Fix iterator_to_array() error on PHP < 8.2
  • Loading branch information
ingeniumed authored Sep 10, 2024
2 parents bdc361d + 591c50b commit 079599c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
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
4 changes: 2 additions & 2 deletions vip-block-data-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Access Gutenberg block data in JSON via the REST API.
* Author: WordPress VIP
* Text Domain: vip-block-data-api
* Version: 1.4.0
* Version: 1.4.1
* Requires at least: 6.0
* Tested up to: 6.6
* Requires PHP: 8.0
Expand All @@ -20,7 +20,7 @@
if ( ! defined( 'VIP_BLOCK_DATA_API_LOADED' ) ) {
define( 'VIP_BLOCK_DATA_API_LOADED', true );

define( 'WPCOMVIP__BLOCK_DATA_API__PLUGIN_VERSION', '1.4.0' );
define( 'WPCOMVIP__BLOCK_DATA_API__PLUGIN_VERSION', '1.4.1' );
define( 'WPCOMVIP__BLOCK_DATA_API__REST_ROUTE', 'vip-block-data-api/v1' );

// Analytics related configs.
Expand Down

0 comments on commit 079599c

Please sign in to comment.