Opened 3 years ago
Closed 3 years ago
#53738 closed defect (bug) (fixed)
Broken loop in WP_Theme_JSON_Resolver
Reported by: | schlessera | Owned by: | desrosj |
---|---|---|---|
Milestone: | 5.8.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Themes | Keywords: | fixed-major |
Focuses: | Cc: |
Description
Originally reported at https://github.com/WordPress/gutenberg/issues/33552.
The loop in WP_Theme_JSON_Resolver
to extract translatable paths is broken, as it contains an immediate and unconditional return
. This causes the loop to immediately exit again after the first iteration, thus never actually looping.
foreach ( $partial_child as $key => $context ) { return array( array( 'path' => $current_path, 'key' => $key, 'context' => $context, ), ); }
This means that the extraction only works where there's only a single item in the array of translatable strings per section (i.e. the 'name'
field).
The suggested code would be:
foreach ( $partial_child as $key => $context ) { $result[] = array( 'path' => $current_path, 'key' => $key, 'context' => $context, ); } return $result;
Change History (3)
#2
@
3 years ago
This was fixed for 5.9 in [51472].
This ticket was created for 5.8.1 consideration, per the Slack discussion.
Note: See
TracTickets for help on using
tickets.
Changing the Reporter field to the reporter of the original issue.