Make WordPress Core


Ignore:
Timestamp:
10/29/2016 11:22:50 AM (9 years ago)
Author:
ocean90
Message:

I18N: Don't initialize WP_Locale_Switcher in wp_load_translations_early().

wp_load_translations_early() is used when WordPress isn't fully initialized. Therefore using the WP_Locale_Switcher with get_locale()/get_user_locale() can cause PHP fatal errors.
This reverts [38976] and [38977], and instead removes WP_Locale_Switcher from wp_load_translations_early().

See #29783.
Fixes #38535.

File:
1 edited

Legend:

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

    r38978 r39005  
    4949    if ( defined( 'WPLANG' ) ) {
    5050        $locale = WPLANG;
    51     }
    52 
    53     // If $wpdb hasn't been initialised yet, we can only return what we have.
    54     if ( ! $wpdb ) {
    55         if ( ! $locale ) {
    56             $locale = 'en_US';
    57         }
    58 
    59         /** This filter is documented in wp-includes/l10n.php */
    60         return apply_filters( 'locale', $locale );
    6151    }
    6252
Note: See TracChangeset for help on using the changeset viewer.