Make WordPress Core

Changeset 51472


Ignore:
Timestamp:
07/22/2021 10:05:33 AM (3 years ago)
Author:
gziolo
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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme-json-resolver.php

    r51284 r51472  
    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.