diff --git a/src/wp-includes/blocks.php b/src/wp-includes/blocks.php index a0360ffdc8bf8..2b5ed62a74388 100644 --- a/src/wp-includes/blocks.php +++ b/src/wp-includes/blocks.php @@ -677,7 +677,8 @@ function register_block_type_from_metadata( $file_or_folder, $args = array() ) { $scripts = $metadata[ $metadata_field_name ]; $processed_scripts = array(); if ( is_array( $scripts ) ) { - for ( $index = 0; $index < count( $scripts ); $index++ ) { + $script_count = count( $scripts ); + for ( $index = 0; $index < $script_count; $index++ ) { $result = register_block_script_handle( $metadata, $metadata_field_name, @@ -711,7 +712,8 @@ function register_block_type_from_metadata( $file_or_folder, $args = array() ) { $modules = $metadata[ $metadata_field_name ]; $processed_modules = array(); if ( is_array( $modules ) ) { - for ( $index = 0; $index < count( $modules ); $index++ ) { + $module_count = count( $modules ); + for ( $index = 0; $index < $module_count; $index++ ) { $result = register_block_script_module_id( $metadata, $metadata_field_name, @@ -747,7 +749,8 @@ function register_block_type_from_metadata( $file_or_folder, $args = array() ) { $styles = $metadata[ $metadata_field_name ]; $processed_styles = array(); if ( is_array( $styles ) ) { - for ( $index = 0; $index < count( $styles ); $index++ ) { + $style_count = count( $styles ); + for ( $index = 0; $index < $style_count; $index++ ) { $result = register_block_style_handle( $metadata, $metadata_field_name, diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index 7e2cb54731b1f..be77c486ce6f5 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -5379,7 +5379,8 @@ public function set_spacing_sizes() { // If there are 7 or fewer steps in the scale revert to numbers for labels instead of t-shirt sizes. if ( $spacing_scale['steps'] <= 7 ) { - for ( $spacing_sizes_count = 0; $spacing_sizes_count < count( $spacing_sizes ); $spacing_sizes_count++ ) { + $total_spacing_sizes = count( $spacing_sizes ); + for ( $spacing_sizes_count = 0; $spacing_sizes_count < $total_spacing_sizes; $spacing_sizes_count++ ) { $spacing_sizes[ $spacing_sizes_count ]['name'] = (string) ( $spacing_sizes_count + 1 ); } }