Make WordPress Core

Changeset 51515


Ignore:
Timestamp:
07/30/2021 12:20:38 PM (4 years ago)
Author:
desrosj
Message:

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.
Merges [51472] to the 5.8 branch.
Fixes #53738.

Location:
branches/5.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

  • branches/5.8/src/wp-includes/class-wp-theme-json-resolver.php

    r51315 r51515  
    122122            if ( is_numeric( $property ) ) {
    123123                foreach ( $partial_child as $key => $context ) {
    124                     return array(
    125                         array(
    126                             'path'    => $current_path,
    127                             'key'     => $key,
    128                             'context' => $context,
    129                         ),
     124                    $result[] = array(
     125                        'path'    => $current_path,
     126                        'key'     => $key,
     127                        'context' => $context,
    130128                    );
    131129                }
     130                return $result;
    132131            }
    133132            $result = array_merge(
Note: See TracChangeset for help on using the changeset viewer.