Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix iterator_to_array() error on PHP < 8.2 #78

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading