Make WordPress Core


Ignore:
Timestamp:
05/16/2023 02:40:11 PM (3 years ago)
Author:
audrasjb
Message:

I18N: Introduce sanitization function for locale.

Introduce the sanitize_locale_name() for sanitizing user input of locales.

Props xknown, timothyblynjacobs, ocean90, peterwilsoncc.
Merges [55760] to branch 6.2.

File:
1 edited

Legend:

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

    r55351 r55765  
    150150
    151151        if ( ! empty( $_GET['wp_lang'] ) ) {
    152                 $wp_lang = sanitize_text_field( $_GET['wp_lang'] );
     152                $wp_lang = sanitize_locale_name( wp_unslash( $_GET['wp_lang'] ) );
    153153        } elseif ( ! empty( $_COOKIE['wp_lang'] ) ) {
    154                 $wp_lang = sanitize_text_field( $_COOKIE['wp_lang'] );
     154                $wp_lang = sanitize_locale_name( wp_unslash( $_COOKIE['wp_lang'] ) );
    155155        }
    156156
Note: See TracChangeset for help on using the changeset viewer.