Make WordPress Core

Changeset 55351

Timestamp:
02/15/2023 11:35:33 PM (18 months ago)
Author:
SergeyBiryukov
Message:

I18N: Check that $wp_locale global is set before calling its methods.

This avoids a fatal error if these functions are called in a mu-plugin before $wp_locale is set:

  • wp_get_list_item_separator()
  • wp_get_word_count_type()

Follow-up to [52929], [52933], [55279], [55295].

Props kraftbj.
Fixes #56698.

Location:
trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-locale.php

    r55295 r55351  
    236236        $this->number_format['decimal_point'] = ( 'number_format_decimal_point' === $decimal_point ) ? '.' : $decimal_point;
    237237
    238         /* translators: used between list items, there is a space after the comma */
     238        /* translators: */
    239239        $this->list_item_separator = __( ', ' );
    240240
  • trunk/src/wp-includes/l10n.php

    r55295 r55351  
    18081808    global $wp_locale;
    18091809
     1810
     1811
     1812
     1813
     1814
     1815
    18101816    return $wp_locale->get_list_item_separator();
    18111817}
     
    18241830    global $wp_locale;
    18251831
     1832
     1833
     1834
     1835
     1836
    18261837    return $wp_locale->get_word_count_type();
    18271838}
Note: See TracChangeset for help on using the changeset viewer.