From 3f83b507435ec0c110ee89aadfa623af80275639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Zi=C3=83=C2=B3=C3=85=E2=80=9Akowski?= Date: Thu, 22 Jul 2021 10:05:33 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@51472 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-theme-json-resolver.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/wp-includes/class-wp-theme-json-resolver.php b/src/wp-includes/class-wp-theme-json-resolver.php index 23d4eb0f61..39354106f2 100644 --- a/src/wp-includes/class-wp-theme-json-resolver.php +++ b/src/wp-includes/class-wp-theme-json-resolver.php @@ -121,14 +121,13 @@ class WP_Theme_JSON_Resolver { foreach ( $i18n_partial as $property => $partial_child ) { if ( is_numeric( $property ) ) { foreach ( $partial_child as $key => $context ) { - return array( - array( - 'path' => $current_path, - 'key' => $key, - 'context' => $context, - ), + $result[] = array( + 'path' => $current_path, + 'key' => $key, + 'context' => $context, ); } + return $result; } $result = array_merge( $result,