Opened 5 years ago
Closed 5 years ago
#53738 closed defect (bug) (fixed)
Broken loop in WP_Theme_JSON_Resolver
| Reported by: | schlessera | Owned by: | desrosj |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.8.1 |
| Component: | Themes | Version: | |
| Severity: | normal | Keywords: | fixed-major |
| Cc: | Focuses: |
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)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Changing the Reporter field to the reporter of the original issue.