I18n: Fix broken loop in WP_Theme_JSON_Resolver

Related issue in Gutenberg: https://github.com/WordPress/gutenberg/issues/33552

The loop in WP_Theme_JSON_Resolver to extract translatable paths was broken, as it contained an immediate and unconditional return. This caused the loop to immediately exit again after the first iteration, thus never actually looping.

Follow-up to [50959].

Props schlessera.
 

Built from https://develop.svn.wordpress.org/trunk@51472


git-svn-id: http://core.svn.wordpress.org/trunk@51083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
gziolo 2021-07-22 10:06:57 +00:00
parent 60c39d7805
commit c7ff035183
2 changed files with 6 additions and 7 deletions

View File

@ -121,14 +121,13 @@ class WP_Theme_JSON_Resolver {
foreach ( $i18n_partial as $property => $partial_child ) { foreach ( $i18n_partial as $property => $partial_child ) {
if ( is_numeric( $property ) ) { if ( is_numeric( $property ) ) {
foreach ( $partial_child as $key => $context ) { foreach ( $partial_child as $key => $context ) {
return array( $result[] = array(
array( 'path' => $current_path,
'path' => $current_path, 'key' => $key,
'key' => $key, 'context' => $context,
'context' => $context,
),
); );
} }
return $result;
} }
$result = array_merge( $result = array_merge(
$result, $result,

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.9-alpha-51471'; $wp_version = '5.9-alpha-51472';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.